Esempio n. 1
0
 findKeys: function(startingWithKey) {
   var options = {
     keys: startingWithKey
   };
   if (!this.db) {
     throw new Error('Db must be defined');
   }
   var args = [this, options];
   return nodefn.apply(_.bind(this.db.findKeys, this.db), args);
 }
Esempio n. 2
0
 _callAdapter: function(fn, options, models) {
   options = options ? _.clone(options) : {};
   if (!this.indexDb) {
     throw new Error('indexDb must be defined');
   }
   options.indexKey = this.indexKey;
   var args = [this, options];
   if (models) args.splice(1, 0, models);
   return nodefn.apply(_.bind(this.indexDb[fn], this.indexDb), args);
 }
 readFromIndex: function(options) {
   if (!this.indexDb) {
     throw new Error('indexDb must be defined');
   }
   if (!this.indexDb.readFromIndexes) {
     throw new Error('indexDb does not support reading from multiple indexes');
   }
   options = options ? _.clone(options) : {};
   options.indexKeys = this.indexKeys;
   options.unionKey = this.unionKey;
   var args = [this, options];
   return nodefn.apply(_.bind(this.indexDb.readFromIndexes, this.indexDb), args);
 },