Expand description
The expression tree used inside WHERE/SET/projection clauses.
Values render to SurrealQL via the SurrealQL trait (literals) and the
DynExpr trait (composed expressions). The building blocks include typed
Column accessors, the untyped Ident, the Raw escape hatch,
RecordLink (type::record(...)), Func calls, and comparison/logical
operators that combine with .and() / .or().
Structs§
- AndExpr
- Column
- A typed reference to a record field — e.g.
Post::title()yields aColumn<Post, String>. Generated by#[derive(SurrealRecord)]and used to build type-checked filters (.eq(...),.gt(...), …) and projections. - Column
Meta - Column
Set - Select-all (
*) column list. Generated by#[derive(SurrealRecord)]. - Contains
Expr - EqExpr
- Func
- A SurrealQL function call
name(args…). - Grouped
- Wraps an expression in parentheses:
(<expr>). Use to force grouping/precedence. - GtExpr
- GteExpr
- Ident
- An untyped identifier (column or field path) for building filter expressions
where a typed
Columnaccessor is unavailable (e.g. record-link fields the derive doesn’t expose, ortenant.slugpaths). MirrorsColumn’s operators. - IfExpr
- A SurrealQL
IF <cond> THEN <expr> [ELSE IF <cond> THEN <expr>]… [ELSE <expr>] ENDexpression. As aDynExprit nests anywhere an expression is taken — aSETvalue, aSELECTprojection, aRETURN, or aWHERE. - InExpr
- Literal
- LtExpr
- LteExpr
- NeExpr
- NoneLit
- SurrealDB’s
NONE. - NotExpr
- NotIn
Expr - OrExpr
- Param
- A named SurrealQL parameter
$name. In inline mode renders as a literal; in param mode (to_surrealql_with_params) renders as$nameand collects the value. Use when you want to reference the same value in multiple places or give params meaningful names. - Path
- A graph-traversal expression — e.g.
->wrote->post,<-wrote<-user, or a multi-hop chain with an optional.field/.*accessor at the end. - Projection
- A single SELECT-list entry. Either a bare expression or
<expr> AS <alias>. - Raw
- A verbatim SurrealQL fragment. Use for expressions somnia does not model as
typed nodes (e.g.
IF x != NONE THEN … END, lambdas,tenant.slug). - Record
Link - Builds a SurrealDB record link
type::record('table', <key>). The key is any literal value (typically the bare UUID/string id of the related row).
Enums§
- Order
- Sort direction for
ORDER BY.
Traits§
- DynExpr
- A type-erased expression that can render itself into a SurrealQL buffer. Implemented by every expression node; the common currency of the builder.
- Expr
- A
DynExprthat also reports a SurrealQL type hint. Auto-implemented for everyDynExpr(returning"any"); concrete nodes may override the hint. - SurrealQL
- A Rust type that can be rendered as a SurrealQL literal (the right-hand side of
comparisons,
SETvalues, etc.). Implemented for the common scalar types,Option<T>,serde_json::Value, the geometry types, andThing<T>.
Functions§
- col
- A bare column name as a projection:
name. - field
<raw> AS <alias>— verbatim expression with an alias.- ident
- Construct an
Identfor a field name.
Type Aliases§
- DynExpr
Box - A boxed, type-erased expression. Useful for returning a composed filter from a helper function (e.g. a shared tenant/owner predicate).