loopback-component-storage/lib/storage-connector.js

29 lines
796 B
JavaScript
Raw Normal View History

2014-01-10 19:34:37 +00:00
var StorageService = require('./storage-service');
2013-07-03 23:58:20 +00:00
/**
* Export the initialize method to Loopback data
* @param dataSource
2013-07-03 23:58:20 +00:00
* @param callback
*/
exports.initialize = function (dataSource, callback) {
2014-01-24 17:44:58 +00:00
var settings = dataSource.settings || {};
2013-07-03 23:58:20 +00:00
2014-01-24 17:44:58 +00:00
var connector = new StorageService(settings);
dataSource.connector = connector;
dataSource.connector.dataSource = dataSource;
2013-07-03 23:58:20 +00:00
2014-01-24 17:44:58 +00:00
connector.DataAccessObject = function () {
};
for (var m in StorageService.prototype) {
var method = StorageService.prototype[m];
if ('function' === typeof method) {
connector.DataAccessObject[m] = method.bind(connector);
for (var k in method) {
connector.DataAccessObject[m][k] = method[k];
}
2013-07-03 23:58:20 +00:00
}
2014-01-24 17:44:58 +00:00
}
2013-07-03 23:58:20 +00:00
2014-01-24 17:44:58 +00:00
connector.define = function (model, properties, settings) {
};
2014-01-10 19:34:37 +00:00
};