Expressions
Expressions show up everywhere in RQL: filters, computed columns, aggregations. They are built from operators, literals, column references, and function calls.
Operators
Arithmetic
| Operator | Description | Example |
|---|---|---|
| + | Addition | price + tax |
| - | Subtraction | total - discount |
| * | Multiplication | quantity * price |
| / | Division | total / count |
| // | Integer division | total // 10 |
| % | Modulo | id % 2 |
Comparison
| Operator | Description | Example |
|---|---|---|
| == | Equal | status == "active" |
| != | Not equal | role != "guest" |
| > | Greater than | age > 18 |
| < | Less than | price < 100 |
| >= | Greater or equal | count >= 10 |
| <= | Less or equal | stock <= 5 |
| ~= | Pattern match | email ~= "%@gmail.com" |
Logical
| Operator | Description | Example |
|---|---|---|
| && | Logical AND | active && verified |
| || | Logical OR | admin || moderator |
| ?? | Null coalesce | nickname ?? name |
Other
| Operator | Description | Example |
|---|---|---|
| -> | Field access | user->address |
| => | Lambda expression | x => x * 2 |
Built-in Modules
RQL ships with built-in modules for common operations. Call them with the :: syntax.
math
Sums, averages, rounding, and more.
$ math module
text
Lowercase, uppercase, trim, and more.
$ text module
date
Extract, format, and calculate with dates.
$ date module
Case Expression
Use case when you need if/else logic inside a query:
$ Case Expression
Named Arguments
Named arguments make your intent obvious:
$ Named Arguments
Combining Expressions
You can combine expressions freely. Use parentheses when you need to control precedence.
