UNPKG

@sqb/builder

Version:

Extensible multi-dialect SQL query builder written with TypeScript

18 lines (17 loc) 560 B
import { OperatorType, SerializationType } from '../../enums.js'; import { Operator } from '../operator.js'; export class OpNot extends Operator { _operatorType = OperatorType.not; _expression; constructor(expression) { super(); this._expression = expression; } get _type() { return SerializationType.NEGATIVE_EXPRESSION; } _serialize(ctx) { const expression = ctx.anyToSQL(this._expression); return ctx.serialize(this._type, expression, () => expression ? 'not ' + expression : ''); } }