Skip to main content

SQLComparisonExpression

@webda/postgres


Class: SQLComparisonExpression

Defined in: postgres/src/sqlstore.ts:38

Extends ComparisonExpression to emit SQL-compatible string literals for JSONB comparisons

Extends​

  • ComparisonExpression

Constructors​

Constructor​

new SQLComparisonExpression(operator, attribute, value): SQLComparisonExpression

Defined in: ql/lib/query.d.ts:303

Parameters​

operator​

ComparisonOperator

comparison operator

attribute​

string

dot-notation path to the object property (e.g. "user.name")

value​

any[] | value

literal value or array of values (for IN operator) to compare against

Returns​

SQLComparisonExpression

Inherited from​

WebdaQL.ComparisonExpression.constructor

Properties​

attribute​

attribute: string[]

Defined in: ql/lib/query.d.ts:297

Attribute to read from the object (split by .)

Inherited from​

WebdaQL.ComparisonExpression.attribute


operator​

operator: ComparisonOperator

Defined in: ql/lib/query.d.ts:250

Inherited from​

WebdaQL.ComparisonExpression.operator


value​

value: value | value[]

Defined in: ql/lib/query.d.ts:293

Right side of the comparison

Inherited from​

WebdaQL.ComparisonExpression.value

Methods​

eval()​

eval(target): boolean

Defined in: ql/lib/query.d.ts:334

Parameters​

target​

any

Returns​

boolean

Inherited from​

WebdaQL.ComparisonExpression.eval


setAttributeValue()​

setAttributeValue(target): void

Defined in: ql/lib/query.d.ts:330

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


toString()​

toString(): string

Defined in: ql/lib/query.d.ts:356

Returns​

string

Inherited from​

WebdaQL.ComparisonExpression.toString


toStringAttribute()​

toStringAttribute(): string

Defined in: postgres/src/sqlstore.ts:59

Returns​

string

SQL attribute expression with type cast

Overrides​

WebdaQL.ComparisonExpression.toStringAttribute


toStringOperator()​

toStringOperator(): ComparisonOperator

Defined in: ql/lib/query.d.ts:352

Allow subclass to create different display

Returns​

ComparisonOperator

the operator string

Inherited from​

WebdaQL.ComparisonExpression.toStringOperator


toStringValue()​

toStringValue(value): string

Defined in: postgres/src/sqlstore.ts:48

Single quotes are doubled so a value can never close the literal. Backslashes stay literal: with standard_conforming_strings (PostgreSQL default) \\ is not an escape character in '...' strings — only LIKE gives it a meaning.

Parameters​

value​

string | number | boolean | (string | number | boolean)[]

the value to stringify

Returns​

string

SQL-compatible string literal

Overrides​

WebdaQL.ComparisonExpression.toStringValue


getAttributeValue()​

static getAttributeValue(target, attribute): any

Defined in: ql/lib/query.d.ts:323

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()​

static likeToRegex(like): RegExp

Defined in: ql/lib/query.d.ts:315

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