Merge pull request #92 from strongloop/cass-work
Add generateUniqueId prototype
This commit is contained in:
commit
4d1574521d
|
@ -54,6 +54,20 @@ Connector.prototype.getDefaultIdType = function(prop) {
|
||||||
return String;
|
return String;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate random id. Each data source model must override this method.
|
||||||
|
* @param {String} modelName Model name
|
||||||
|
* @returns {<model dependent>} Data type varies from model to model,
|
||||||
|
*/
|
||||||
|
|
||||||
|
Connector.prototype.generateUniqueId = function(modelName) {
|
||||||
|
var idType = this.getDefaultIdType && this.getDefaultIdType();
|
||||||
|
var isTypeFunction = (typeof idType === 'function');
|
||||||
|
var id = this.generateValueByColumnType ? this.generateValueByColumnType(idType) :
|
||||||
|
(typeof idType === 'function' ? idType() : null);
|
||||||
|
return id;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata for the connector
|
* Get the metadata for the connector
|
||||||
* @returns {Object} The metadata object
|
* @returns {Object} The metadata object
|
||||||
|
|
Loading…
Reference in New Issue