@microtica/database
Version:
Database tools
20 lines (19 loc) • 1.31 kB
TypeScript
import * as Promise from "bluebird";
/**
* Facilitates query-chunking by allowing you to process a list in chunks and aggregating the results.
* For a version that does not expect results to be returned, use processInChunks.
* @param values the values to process.
* @param subsetCallback the callback to call for each subset of results.
* Each subset is expected to produce a promise that resolves to a list of results.
* @param [chunkSize] the chunk size. If not specified, will use a server-configured value.
* @return {Promise<R[]>} returns a list of combined results from all chunks.
*/
export declare function getInChunks<V, R>(values: V[], subsetCallback: (valueSubset: V[]) => Promise.Thenable<R[]>, chunkSize?: number): Promise<R[]>;
/**
* Facilitates query-chunking by allowing you to process a list in chunks.
* For a version that aggregates the return results, use getInChunks.
* @param values the values to process.
* @param subsetCallback the callback to call for each subset of results. Each subset is expected to produce a promise.
* @param [chunkSize] the chunk size. If not specified, will use a server-configured value.
*/
export declare function processInChunks<V>(values: V[], subsetCallback: (valueSubset: V[]) => Promise.Thenable<any>, chunkSize?: number): Promise<void>;