Skip to main content

Not

Negates a single operator or Raw expression by prefixing it with not. Different from Ne/IsNot: those compare two values, while Not wraps an arbitrary expression. Extends Operator directly (not CompOperator). Shorthand key: none — Not has no object-literal suffix; use it as an explicit operator instance. not is also a suffix in the Operators map, but as a full-expression wrapper it's normally reached by calling Not(...) directly rather than through the <field> <suffix> shorthand.

Constructor

Not(expression: SqlElement): Not
new Not(expression: SqlElement): Not

Dual-callable.

import { Not, Eq, Select } from '@sqb/builder';

Select().from('customers').where(Not(Eq('active', true)));
// where not active = true

Properties

KeyTypeReadonlyDescription
_typeSerializationType.NEGATIVE_EXPRESSIONYesDiscriminates this node during serialization.
_expressionSqlElementNoThe wrapped expression, set from the constructor.

Plus _operatorType inherited from Operator, always OperatorType.not.

Methods

Not has no chainable methods — it exposes only its serialization logic, which renders '' if the wrapped expression serializes to an empty string, or not <expression> otherwise.

See also