UNPKG

@sequeljs/ast

Version:

A SQL AST manager for JavaScript

20 lines 739 B
import SQLLiteral from '../nodes/SQLLiteral'; import ToSQL from './ToSQL'; export default class WhereSQL extends ToSQL { 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(this.innerVisitor.accept(where, innerCollector).value); }); collector = this.injectJoin(wheres, collector, ' AND '); return collector; } } //# sourceMappingURL=WhereSQL.js.map