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