UNPKG

@dataplan/pg

Version:
37 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PgClassFilter = void 0; const grafast_1 = require("grafast"); const pg_sql2_1 = require("pg-sql2"); const utils_ts_1 = require("../utils.js"); class PgClassFilter extends grafast_1.Modifier { static { this.$$export = { moduleName: "@dataplan/pg", exportName: "PgClassFilter", }; } constructor(parent, alias) { super(parent); this.conditions = []; this.havingConditions = []; this.alias = alias; } where(condition) { this.conditions.push((0, utils_ts_1.runtimeScopedSQL)(condition)); } having(condition) { this.havingConditions.push((0, utils_ts_1.runtimeScopedSQL)(condition)); } apply() { this.conditions.forEach((condition) => this.parent.where(condition)); this.havingConditions.forEach((condition) => this.parent.having(condition)); } /** * @deprecated Only present for backwards compatibility, we want TypeScript to reject these embeds. * @internal */ [pg_sql2_1.$$toSQL]() { return this.alias; } } exports.PgClassFilter = PgClassFilter; //# sourceMappingURL=pgClassFilter.js.map