UNPKG

@sequeljs/ast

Version:

A SQL AST manager for JavaScript

23 lines 863 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const SQLLiteral_1 = require("../nodes/SQLLiteral"); const ToSQL_1 = require("./ToSQL"); class WhereSQL extends ToSQL_1.default { constructor(innerVisitor, connection) { super(connection); this.innerVisitor = innerVisitor; } visitSelectCore(thing, col) { let collector = col; collector.append(' WHERE '); const wheres = thing.wheres.map((where) => { const CollectorClass = col.constructor; const innerCollector = new CollectorClass(); return new SQLLiteral_1.default(this.innerVisitor.accept(where, innerCollector).value); }); collector = this.injectJoin(wheres, collector, ' AND '); return collector; } } exports.default = WhereSQL; //# sourceMappingURL=WhereSQL.js.map