@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
25 lines • 1.13 kB
TypeScript
import type { MaybeCallable } from "../internal/misc";
import type { QueryAnnotation } from "./QueryAnnotation";
import type { Runner } from "./Runner";
/**
* Batcher is similar to DataLoader, but with a few important differences:
* 1. It's strongly typed not only for the output, but for input too. And input
* can be arbitrary, not only strings (e.g. rows).
* 2. It does requests dedupping for all queries (including selects).
* 3. It's not limited by read-only requests like DataLoader, and thus it
* doesn't to any caching. Caching is delegated to some other layer (either
* above Batcher or in Runner).
*/
export declare class Batcher<TInput, TOutput> {
private runner;
private batchDelayMs;
private disableBatching;
private queuedInputs;
private queuedDefers;
private queuedAnnotations;
protected flushQueue: () => Promise<void>;
constructor(runner: Runner<TInput, TOutput>, batchDelayMs: MaybeCallable<number>, disableBatching: boolean);
run(input: TInput, annotation: QueryAnnotation): Promise<TOutput>;
private runSingleForEach;
}
//# sourceMappingURL=Batcher.d.ts.map