UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

33 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Runner = void 0; const INIT_SEQUENCE = 3; // small prime, doesn't matter /** * Knows how to translate individual strongly typed requests into DB language * and how to parse the result back. */ class Runner { /** * Parameter `name` is typically a table name. */ constructor(name) { this.name = name; /** Used to build an unique default operation key. */ this.sequence = INIT_SEQUENCE; } /** * Returns a batch-dedupping key for the input. By default, no dedupping is * performed (i.e. all inputs are processed individually and not collapsed * into one input; e.g. this is needed for inserts). */ key(_input) { const key = "k" + this.sequence; this.sequence += INIT_SEQUENCE; if (this.sequence > INIT_SEQUENCE * 10000000) { this.sequence = INIT_SEQUENCE; } return key; } } exports.Runner = Runner; //# sourceMappingURL=Runner.js.map