UNPKG

@sequeljs/ast

Version:

A SQL AST manager for JavaScript

28 lines 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Else_1 = require("./Else"); const NodeExpression_1 = require("./NodeExpression"); const When_1 = require("./When"); const buildQuoted_1 = require("./buildQuoted"); class Case extends NodeExpression_1.default { constructor(expression = null, defaultVal = null) { super(); this.conditions = []; this.default = defaultVal; this.case = expression; } else(expression) { this.default = new Else_1.default((0, buildQuoted_1.default)(expression)); return this; } then(expression) { this.conditions[this.conditions.length - 1].right = (0, buildQuoted_1.default)(expression); return this; } when(condition, expression = null) { this.conditions.push(new When_1.default((0, buildQuoted_1.default)(condition), expression)); return this; } } exports.default = Case; //# sourceMappingURL=Case.js.map