SQLColumnComparisonExpression
Class: SQLColumnComparisonExpression
Defined in: packages/sql/src/relational/comparison.ts:72
A WebdaQL comparison on a typed column
Keeps the in-memory semantics of ComparisonExpression.eval:
- a value of the column type compares natively (
"n" < 2,"d" > '2024-01-01'); =/!=with a value of another type compare the text of the column, so the loosen = '1'still matches andn = 'abc'never raises a cast error;!=is null-safe; a time column reads as its ISO text, so a text that is not a date (_lastUpdate = 'abc') matches nothing instead of raising;- an ordering comparison with a value of another type is
FALSE, as comparing a number with a string is; LIKEworks on the text of the column (the ISO text of a time column);CONTAINSis for JSON columns only.
Extends
ComparisonExpression
Constructors
Constructor
new SQLColumnComparisonExpression(
operator,column,value,type,dialect):SQLColumnComparisonExpression
Defined in: packages/sql/src/relational/comparison.ts:81
Create a new SQLColumnComparisonExpression instance
Parameters
operator
ComparisonOperator
the comparison operator
column
string
the quoted column
value
any
the compared value
type
ColumnType
the column type
dialect
the engine syntax
Returns
SQLColumnComparisonExpression
Overrides
WebdaQL.ComparisonExpression.constructor
Properties
attribute
attribute:
string[]
Defined in: packages/ql/lib/query.d.ts:459
Attribute to read from the object (split by .)
Inherited from
WebdaQL.ComparisonExpression.attribute
dialect
protectedreadonlydialect:RelationalDialect
Defined in: packages/sql/src/relational/comparison.ts:86
the engine syntax
operator
operator:
ComparisonOperator
Defined in: packages/ql/lib/query.d.ts:408
Operator
Inherited from
WebdaQL.ComparisonExpression.operator
rawValue
rawValue:
value|DynamicValue| value | DynamicValue[] |null
Defined in: packages/ql/lib/query.d.ts:455
Right side of the comparison (raw parsed value, possibly DynamicValue)
Inherited from
WebdaQL.ComparisonExpression.rawValue
type
protectedreadonlytype:ColumnType
Defined in: packages/sql/src/relational/comparison.ts:85
the column type
Accessors
value
Get Signature
get value():
value|value[] |null
Defined in: packages/ql/lib/query.d.ts:471
Resolved value at evaluation time
Returns
value | value[] | null
the resolved scalar or array value
Set Signature
set value(
val):void
Defined in: packages/ql/lib/query.d.ts:476
Set the raw value
Parameters
val
value | DynamicValue | value | DynamicValue[] | null
new value
Returns
void
Inherited from
WebdaQL.ComparisonExpression.value
Methods
eval()
eval(
target):boolean
Defined in: packages/ql/lib/query.d.ts:511
Parameters
target
any
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.eval
isDynamic()
isDynamic():
boolean
Defined in: packages/ql/lib/query.d.ts:480
Returns
boolean
Inherited from
WebdaQL.ComparisonExpression.isDynamic
setAttributeValue()
setAttributeValue(
target):void
Defined in: packages/ql/lib/query.d.ts:507
Set the value of the attribute based on the assignment
If used as a Set expression
Parameters
target
any
the object to assign to
Returns
void
Inherited from
WebdaQL.ComparisonExpression.setAttributeValue
text()
protectedtext(column):string
Defined in: packages/sql/src/relational/comparison.ts:126
Return the column as the text the model holds: itself for a text kind, the ISO form of a time kind, a cast
Parameters
column
string
the quoted column
Returns
string
the column as the text the model holds: itself for a text kind, the ISO form of a time kind, a cast otherwise
toString()
toString():
string
Defined in: packages/sql/src/relational/comparison.ts:95
Return a string representation of this instance
Returns
string
the SQL condition
Overrides
WebdaQL.ComparisonExpression.toString
toStringAttribute()
toStringAttribute():
string
Defined in: packages/ql/lib/query.d.ts:525
Allow subclass to create different display
Returns
string
the attribute string
Inherited from
WebdaQL.ComparisonExpression.toStringAttribute
toStringOperator()
toStringOperator():
ComparisonOperator
Defined in: packages/ql/lib/query.d.ts:530
Allow subclass to create different display
Returns
ComparisonOperator
the operator string
Inherited from
WebdaQL.ComparisonExpression.toStringOperator
toStringValue()
toStringValue(
value):string
Defined in: packages/ql/lib/query.d.ts:520
Serialize a value to its WebdaQL string representation
Strings are double-quoted, booleans are uppercased, arrays are bracket-wrapped.
Dynamic values serialize to their canonical function call string (e.g. NOW('-10m')).
Parameters
value
value | DynamicValue | value | DynamicValue[] | null
the value to serialize
Returns
string
the serialized string
Inherited from
WebdaQL.ComparisonExpression.toStringValue
getAttributeValue()
staticgetAttributeValue(target,attribute):any
Defined in: packages/ql/lib/query.d.ts:500
Traverse an object using a dot-notation attribute path
Parameters
target
any
object to read from
attribute
string[]
path segments (e.g. ["user", "profile", "name"])
Returns
any
the resolved value, or undefined if any segment is missing
Inherited from
WebdaQL.ComparisonExpression.getAttributeValue
likeToRegex()
staticlikeToRegex(like):RegExp
Defined in: packages/ql/lib/query.d.ts:492
Convert a SQL LIKE pattern to a JavaScript RegExp
%matches zero or more characters_matches exactly one character\%and\_are literal percent/underscore- Common regex metacharacters are escaped
Parameters
like
string
SQL LIKE pattern string
Returns
RegExp
compiled RegExp
Inherited from
WebdaQL.ComparisonExpression.likeToRegex