Query Expressions

Description

We provide a system for filtering state queries via expressions similar to those used by mongoDB.


Data Structures

Expression

interface Expression {
  [operator: string]: Array<string | number | Expression>
}

Description

Represents an expression. All expressions consist of an operator and a list of input values. Some expressions take other operators as input values.


Operators

Boolean Operators

$and

{ $and: [ <expression1>, <expression2>, ... ] }
Description

Returns true if all arguments evaluate to true.

Parameters
  1. expressions - Expression[]: Any number of Expression objects.
Returns

boolean: true if all arguments resolve to true, false otherwise.


$not

{ $not: [ <expression> ] }
Description

Returns the boolean opposite of the result of the argument expression.

Parameters
  1. expression: Expression: A single Expression object.
Returns

boolean: true if the expression resolves to false, false otherwise.


$or

{ $or: [ <expression1>, <expression2>, ... ] }
Description

Returns true if any argument evaluates to true.

Parameters
  1. expressions - Expression[]: Any number of Expression objects.
Returns

boolean: true if any argument resolves to true, false otherwise.


Comparison Operators

$eq

{ $eq: [ <argument1>, <argument2>, ... ] }
Description

Checks if all arguments are equal.

Parameters
  1. arguments - any[]: List of input values.
Returns

boolean: true if all arguments are equal, false otherwise.


$gt

{ $gt: [ <argument1>, <argument2> ] }
Description

Checks if the first argument is greater than the second.

Parameters
  1. argument1 - any: First input value.
  2. argument2 - any: Second input value.
Returns

boolean: true if the first argument is greater than the second, false otherwise.


$gte

{ $gte: [ <argument1>, <argument2> ] }
Description

Checks if the first value is greater than or equal to the second.

Parameters
  1. argument1 - any: First input value.
  2. argument2 - any: Second input value.
Returns

boolean: true if the first value is greater than or equal to the second, false otherwise.


$lt

{ $lt: [ <argument1>, <argument2> ] }
Description

Checks if the first value is less than the second.

Parameters
  1. argument1 - any: First input value.
  2. argument2 - any: Second input value.
Returns

boolean: true if the first value is less than the second, false otherwise.


$lte

{ $lte: [ <argument1>, <argument2> ] }
Description

Checks if the first value is less than or equal to the second.

Parameters
  1. argument1 - any: First input value.
  2. argument2 - any: Second input value.
Returns

boolean: true if the first value is less than or equal to the second, false otherwise.


$ne

{ $ne: [ <argument1>, <argument2>, ... ] }
Description

Returns true if input values are not all equivalent.

Parameters
  1. arguments - any[]: List of input values.
Returns

boolean: true if input values are not equivalent, false otherwise.