2019-05-08 15:45:37 +00:00
|
|
|
// Copyright IBM Corp. 2016,2018. All Rights Reserved.
|
2016-04-12 12:32:34 +00:00
|
|
|
// Node module: loopback-datasource-juggler
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2016-08-22 19:55:22 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-12-07 14:54:29 +00:00
|
|
|
let lastId = 0;
|
2016-04-12 12:32:34 +00:00
|
|
|
|
|
|
|
exports.next = function() {
|
|
|
|
lastId++;
|
|
|
|
return exports.last();
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.last = function() {
|
|
|
|
return '' + lastId;
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.reset = function() {
|
|
|
|
lastId = 0;
|
|
|
|
};
|
2017-04-06 20:04:16 +00:00
|
|
|
|
|
|
|
exports.fromConnector = function(db) {
|
|
|
|
return (db && db.connector && db.connector.generateUniqueId) ?
|
|
|
|
db.connector.generateUniqueId() : null;
|
|
|
|
};
|