UNPKG

sedk-postgres

Version:

Simple SQL builder and validator

28 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SetStep = void 0; const BaseStep_1 = require("../BaseStep"); const UpdateConditionStep_1 = require("./UpdateConditionStep"); const ReturningStep_1 = require("../ReturningStep"); class SetStep extends BaseStep_1.BaseStep { constructor(prevStep, items) { super(prevStep); this.items = items; } getStepStatement(artifacts = { tables: new Set(), columns: new Set() }) { return `SET ${this.items.map(it => it.getStmt(this.data, artifacts, this.binderStore)).join(', ')}`; } getStepArtifacts() { return { tables: new Set(), columns: new Set(this.items.map(it => it.column)) }; } where(cond1, op1, cond2, op2, cond3) { const whereParts = []; BaseStep_1.BaseStep.addConditionParts(whereParts, cond1, op1, cond2, op2, cond3); return new UpdateConditionStep_1.UpdateWhereStep(this, whereParts); } returning(...items) { return new ReturningStep_1.ReturningStep(this, items); } } exports.SetStep = SetStep; //# sourceMappingURL=SetStep.js.map