Skip to main content

Predicate Expressions


Predicate expressions return a boolean outcome: true, false, or null. They are used to test conditions such as equality, comparison, range inclusion, pattern matching, or null checks. Predicate expressions provide the building blocks for evaluating whether data meets specific rules or criteria.

Usage​

Predicates can be combined using logical expressions like $and, $or, and $not, and are valid in any context where a true/false condition is needed. Most predicates return null if one or more inputs are null. The exception is $distinctFrom, which treats null as a comparable value.


$eq​

Added in: indicate.dsl.dql@1.0.0
Tests whether two expressions are equal.

{
"$eq": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$eq": {
"$left": [ { "$identifier": "age" } ],
"$right": [ { "$scalar": 30 } ]
}
}

$neq​

Added in: indicate.dsl.dql@1.0.0
Tests whether two expressions are not equal.

{
"$neq": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$neq": {
"$left": [ { "$identifier": "status" } ],
"$right": [ { "$scalar": "archived" } ]
}
}

$gt / $gte / $lt / $lte​

Added in: indicate.dsl.dql@1.0.0
Standard comparison operators: greater/less than (or equal).

{
"$gt": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$gt": {
"$left": [ { "$identifier": "score" } ],
"$right": [ { "$scalar": 90 } ]
}
}

$in​

Added in: indicate.dsl.dql@1.0.0
Tests if a value exists in a list of values or subquery.

{
"$in": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$in": {
"$left": [ { "$identifier": "region" } ],
"$right": [ { "$scalar": "EMEA" }, { "$scalar": "APAC" } ]
}
}

$between​

Added in: indicate.dsl.dql@1.0.0
Tests if a value falls between two bounds (inclusive).

{
"$between": {
"$left": [ Object ( Expression ) ],
"$lower": [ Object ( Expression ) ],
"$upper": [ Object ( Expression ) ]
}
}
Example:
{
"$between": {
"$left": [ { "$identifier": "price" } ],
"$lower": [ { "$scalar": 10 } ],
"$upper": [ { "$scalar": 100 } ]
}
}

$like​

Added in: indicate.dsl.dql@1.0.0
Checks if a string matches a pattern using SQL LIKE syntax.

{
"$like": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ],
"$escape": <string>
}
}
Example:
{
"$like": {
"$left": [ { "$identifier": "email" } ],
"$right": [ { "$scalar": "%@indicate.io" } ],
"$escape": "%"
}
}

$similar​

Added in: indicate.dsl.dql@1.0.0
Pattern match using SQL SIMILAR TO.

{
"$similar": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$similar": {
"$left": [ { "$identifier": "status" } ],
"$right": [ { "$scalar": '(draft|archived)%' } ]
}
}

$exists​

Added in: indicate.dsl.dql@1.0.0
Checks whether a subquery returns any rows.

{
"$exists": {
"$selectNode": Object ( SetOperation )
}
}
Example:
{
"$exists": {
"$selectNode": {
"$columns": [ { "$identifier": "id" } ],
"$from": "sessions"
}
}
}

$is​

Added in: indicate.dsl.dql@1.0.0
Tests if a value matches a special identity (NULL, TRUE, etc.).

{
"$is": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$is": {
"$left": [ { "$identifier": "deleted_at" } ],
"$right": [ { "$null": true } ]
}
}

$distinctFrom​

Added in: indicate.dsl.dql@1.0.0
Safe equality check that treats NULL as a value.

{
"$distinctFrom": {
"$left": [ Object ( Expression ) ],
"$right": [ Object ( Expression ) ]
}
}
Example:
{
"$distinctFrom": {
"$left": [ { "$identifier": "status" } ],
"$right": [ { "$scalar": "closed" } ]
}
}