lib/knex-backend.js
function(bucket, keys, cb){
		contract(arguments)
			.params('string', 'array', 'function')
			.end()
		;
		
		var table = '';
		if (bucket.indexOf('allows') != -1) {
			table = this.prefix + this.buckets.permissions;
			this.db
				.select('key', 'value')
				.from(table)
				.where({'key': bucket})
				.then(function(results) {
					if (results.length && results[0].value) {
						var keyArrays = [];
						_.each(keys, function(key) {
							keyArrays.push.apply(keyArrays, results[0].value[key]);
						});
						cb(undefined, _.union(keyArrays));
					} else {
						cb(undefined, []);
					}
					
				})
			;
		} else {
			table = this.prefix + bucket;
			this.db
				.select('key', 'value')
				.from(table)
				.whereIn('key', keys)
				.then(function(results) {
					if (results.length) {
						var keyArrays = [];
						_.each(results, function(result) {
							keyArrays.push.apply(keyArrays, result.value);
						});
						cb(undefined, _.union(keyArrays));
					} else {
						cb(undefined, []);
					}
				})
			;
		}
	}
function(bucket, keys, cb){
		contract(arguments)
			.params('string', 'array', 'function')
			.end()
		;
		
		var table = '';
		if (bucket.indexOf('allows') != -1) {
			table = this.prefix + this.buckets.permissions;
			this.db
				.select('key', 'value')
				.from(table)
				.where({'key': bucket})
				.then(function(results) {
					if (results.length && results[0].value) {
						var keyArrays = [];
						_.each(keys, function(key) {
							keyArrays.push.apply(keyArrays, results[0].value[key]);
						});
						cb(undefined, _.union(keyArrays));
					} else {
						cb(undefined, []);
					}
					
				})
			;
		} else {
			table = this.prefix + bucket;
			this.db
				.select('key', 'value')
				.from(table)
				.whereIn('key', keys)
				.then(function(results) {
					if (results.length) {
						var keyArrays = [];
						_.each(results, function(result) {
							keyArrays.push.apply(keyArrays, result.value);
						});
						cb(undefined, _.union(keyArrays));
					} else {
						cb(undefined, []);
					}
				})
			;
		}
	}
function ( bucket , keys , cb ) { contract ( arguments ) . params ( 'string' , 'array' , 'function' ) . end ( ) ; var table = '' ; if ( bucket . indexOf ( 'allows' ) != - 1 ) { table = this . prefix + this . buckets . permissions ; this . db . select ( 'key' , 'value' ) . from ( table ) . where ( { 'key' : bucket } ) . then ( function ( results ) { if ( results . length && results [ 0 ] . value ) { var keyArrays = [ ] ; _ . each ( keys , function ( key ) { keyArrays . push . apply ( keyArrays , results [ 0 ] . value [ key ] ) ; } ) ; cb ( undefined , _ . union ( keyArrays ) ) ; } else { cb ( undefined , [ ] ) ; } } ) ; } else { table = this . prefix + bucket ; this . db . select ( 'key' , 'value' ) . from ( table ) . whereIn ( 'key' , keys ) . then ( function ( results ) { if ( results . length ) { var keyArrays = [ ] ; _ . each ( results , function ( result ) { keyArrays . push . apply ( keyArrays , result . value ) ; } ) ; cb ( undefined , _ . union ( keyArrays ) ) ; } else { cb ( undefined , [ ] ) ; } } ) ; } }
Returns the union of the values in the given keys.
Returns the union of the values in the given keys .