UNPKG

@dataplan/pg

Version:
38 lines 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PgBooleanFilter = void 0; const grafast_1 = require("grafast"); const pg_sql2_1 = require("pg-sql2"); const utils_ts_1 = require("../utils.js"); class PgBooleanFilter extends grafast_1.Modifier { static { this.$$export = { moduleName: "@dataplan/pg", exportName: "PgBooleanFilter", }; } constructor(classFilter, expression) { super(classFilter); this.conditions = []; this.havingConditions = []; this.alias = classFilter.alias; this.expression = (0, utils_ts_1.runtimeScopedSQL)(expression); } 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.PgBooleanFilter = PgBooleanFilter; //# sourceMappingURL=pgBooleanFilter.js.map