aws/dynamo/query/builders/QueryBuilder.js
/**
		 * Spawns an array of {@link Query} instances, each having the same properties
		 * as the current {@link QueryBuilder}. However, each query is modified to return
		 * a subset of results, by adding additional filters to the range key, according
		 * to instructions provided by the range extractor function.
		 *
		 * @public
		 * @param {QueryBuilder~rangeExtractor} rangeExtractor
		 * @returns {Query[]}
		 */
Spawns an array of  Query instances, each having the same properties
as the current  QueryBuilder. However, each query is modified to return
a subset of results, by adding additional filters to the range key, according
to instructions provided by the range extractor function.

@public
@param {QueryBuilder~rangeExtractor} rangeExtractor
@returns {Query[]}
Spawns an array of Query instances each having the same properties as the current QueryBuilder . However each query is modified to return a subset of results by adding additional filters to the range key according to instructions provided by the range extractor function . @public @param { QueryBuilder~rangeExtractor } rangeExtractor @returns { Query [] }
toParallelQueries(rangeExtractor) {
			assert.argumentIsRequired(rangeExtractor, 'rangeExtractor', Function);
			if (this.query.countOnly) {
				throw new Error('Count queries cannot be run in parallel.');
			}
			const table = this._query.table;
			let rangeKey;
			if (this._query.index === null) {
				rangeKey = table.rangeKey;
			} else {
				const keys = this._query.index.keys;
				rangeKey = keys.find(k => k.keyType === KeyType.RANGE) || null;
			}
			if (rangeKey === null) {
				throw new Error('Unable to use parallelism on a table without a range key.');
			}
			const ranges = rangeExtractor(table);
			if (this._query.orderingType === OrderingType.DESCENDING) {
				ranges.reverse();
			}
			return ranges.map((range, i) => {
				const start = range.start;
				const end = range.end;
				let expression;
				if (!is.null(end) && !is.undefined(end)) {
					expression = new Expression(rangeKey.attribute, OperatorType.BETWEEN, [ start, end ]);
				} else {
					expression = new Expression(rangeKey.attribute, OperatorType.GREATER_THAN_OR_EQUAL_TO, start);
				}
				const parallelFilter = new Filter([ expression ]);
				return new Query(this._query.table, this._query.index, this._query.keyFilter, this._query.resultsFilter, parallelFilter, this._query.attributes, this._query.limit, this._query.orderingType, this._query.consistentRead, this._query.skipDeserialization, false, `${this._query.description} [ ${i} ]`);
			});
		}
toParallelQueries ( rangeExtractor ) { assert . argumentIsRequired ( rangeExtractor , 'rangeExtractor' , Function ) ; if ( this . query . countOnly ) { throw new Error ( 'Count queries cannot be run in parallel.' ) ; } const table = this . _query . table ; let rangeKey ; if ( this . _query . index === null ) { rangeKey = table . rangeKey ; } else { const keys = this . _query . index . keys ; rangeKey = keys . find ( k => k . keyType === KeyType . RANGE ) || null ; } if ( rangeKey === null ) { throw new Error ( 'Unable to use parallelism on a table without a range key.' ) ; } const ranges = rangeExtractor ( table ) ; if ( this . _query . orderingType === OrderingType . DESCENDING ) { ranges . reverse ( ) ; } return ranges . map ( ( range , i ) => { const start = range . start ; const end = range . end ; let expression ; if ( ! is . null ( end ) && ! is . undefined ( end ) ) { expression = new Expression ( rangeKey . attribute , OperatorType . BETWEEN , [ start , end ] ) ; } else { expression = new Expression ( rangeKey . attribute , OperatorType . GREATER_THAN_OR_EQUAL_TO , start ) ; } const parallelFilter = new Filter ( [ expression ] ) ; return new Query ( this . _query . table , this . _query . index , this . _query . keyFilter , this . _query . resultsFilter , parallelFilter , this . _query . attributes , this . _query . limit , this . _query . orderingType , this . _query . consistentRead , this . _query . skipDeserialization , false , ` ${ this . _query . description } ${ i } ` ) ; } ) ; }
Spawns an array of {@link Query} instances, each having the same properties
 as the current {@link QueryBuilder}.
Spawns an array of { @link Query } instances each having the same properties as the current { @link QueryBuilder } .