/** * Expose `DataSource`. */ module.exports = DataSource; /** * Module dependencies. */ var AsteroidModule = require('asteroid-module') , Schema = require('jugglingdb').Schema , debug = require('debug')('connection') , util = require('util') , inherits = util.inherits , assert = require('assert'); /** * Create a new `DataSource` with the given `options`. * * @param {Object} options * @return {DataSource} */ function DataSource(options) { AsteroidModule.apply(this, arguments); this.options = options; // construct a schema with the available adapter // or use the default in memory adapter this.schema = new Schema(this.adapter || require('./memory'), options); debug('created with options', options); } /** * Inherit from `AsteroidModule`. */ inherits(DataSource, AsteroidModule);