Rename schema/adapter to dataSource/connector
This commit is contained in:
parent
c8f68cac1a
commit
08de6ea171
|
@ -1,26 +1,26 @@
|
|||
var StorageService = require('./index');
|
||||
/**
|
||||
* Export the initialize method to JDB
|
||||
* @param schema
|
||||
* Export the initialize method to Loopback data
|
||||
* @param dataSource
|
||||
* @param callback
|
||||
*/
|
||||
exports.initialize = function (schema, callback) {
|
||||
var settings = schema.settings || {};
|
||||
exports.initialize = function (dataSource, callback) {
|
||||
var settings = dataSource.settings || {};
|
||||
|
||||
var adapter = new StorageService(settings);
|
||||
schema.adapter = adapter;
|
||||
schema.adapter.schema = schema;
|
||||
var connector = new StorageService(settings);
|
||||
dataSource.connector = connector;
|
||||
dataSource.connector.dataSource = dataSource;
|
||||
|
||||
adapter.DataAccessObject = function() {};
|
||||
connector.DataAccessObject = function() {};
|
||||
for (var m in StorageService.prototype) {
|
||||
var method = StorageService.prototype[m];
|
||||
if ('function' === typeof method) {
|
||||
adapter.DataAccessObject[m] = method.bind(adapter);
|
||||
connector.DataAccessObject[m] = method.bind(connector);
|
||||
for(var k in method) {
|
||||
adapter.DataAccessObject[m][k] = method[k];
|
||||
connector.DataAccessObject[m][k] = method[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
adapter.define = function(model, properties, settings) {};
|
||||
connector.define = function(model, properties, settings) {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue