pub enum Expr {
Show 41 variants
Ident(Ident),
StringLiteral(StringLiteral),
BacktickLiteral {
span: Span,
value: String,
},
NumberLiteral {
span: Span,
value: String,
},
BoolLiteral {
span: Span,
value: bool,
},
Null {
span: Span,
},
Now {
span: Span,
},
This {
span: Span,
},
Within {
span: Span,
},
DurationLiteral {
span: Span,
value: String,
},
SetLiteral {
span: Span,
elements: Vec<Expr>,
},
ObjectLiteral {
span: Span,
fields: Vec<NamedArg>,
},
GenericType {
span: Span,
name: Box<Expr>,
args: Vec<Expr>,
},
MemberAccess {
span: Span,
object: Box<Expr>,
field: Ident,
},
OptionalAccess {
span: Span,
object: Box<Expr>,
field: Ident,
},
NullCoalesce {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
},
Call {
span: Span,
function: Box<Expr>,
args: Vec<CallArg>,
},
JoinLookup {
span: Span,
entity: Box<Expr>,
fields: Vec<JoinField>,
},
BinaryOp {
span: Span,
left: Box<Expr>,
op: BinaryOp,
right: Box<Expr>,
},
Comparison {
span: Span,
left: Box<Expr>,
op: ComparisonOp,
right: Box<Expr>,
},
LogicalOp {
span: Span,
left: Box<Expr>,
op: LogicalOp,
right: Box<Expr>,
},
Not {
span: Span,
operand: Box<Expr>,
},
In {
span: Span,
element: Box<Expr>,
collection: Box<Expr>,
},
NotIn {
span: Span,
element: Box<Expr>,
collection: Box<Expr>,
},
Exists {
span: Span,
operand: Box<Expr>,
},
NotExists {
span: Span,
operand: Box<Expr>,
},
Where {
span: Span,
source: Box<Expr>,
condition: Box<Expr>,
},
With {
span: Span,
source: Box<Expr>,
predicate: Box<Expr>,
},
Pipe {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
},
Lambda {
span: Span,
param: Box<Expr>,
body: Box<Expr>,
},
Conditional {
span: Span,
branches: Vec<CondBranch>,
else_body: Option<Box<Expr>>,
},
For {
span: Span,
binding: ForBinding,
collection: Box<Expr>,
filter: Option<Box<Expr>>,
body: Box<Expr>,
},
ProjectionMap {
span: Span,
source: Box<Expr>,
field: Ident,
},
TransitionsTo {
span: Span,
subject: Box<Expr>,
new_state: Box<Expr>,
},
Becomes {
span: Span,
subject: Box<Expr>,
new_state: Box<Expr>,
},
Binding {
span: Span,
name: Ident,
value: Box<Expr>,
},
WhenGuard {
span: Span,
action: Box<Expr>,
condition: Box<Expr>,
},
TypeOptional {
span: Span,
inner: Box<Expr>,
},
LetExpr {
span: Span,
name: Ident,
value: Box<Expr>,
},
QualifiedName(QualifiedName),
Block {
span: Span,
items: Vec<Expr>,
},
}Variants§
Ident(Ident)
identifier or _
StringLiteral(StringLiteral)
"text" possibly with {interpolation}
BacktickLiteral
`de-CH-1996` — backtick-quoted enum literal
NumberLiteral
42, 100_000, 3.14
BoolLiteral
true, false
Null
null
Now
now
This
this
Within
within
DurationLiteral
24.hours, 7.days
SetLiteral
{ a, b, c } — set literal
ObjectLiteral
{ key: value, ... } — object literal
GenericType
Set<T>, List<T> — generic type annotation
MemberAccess
a.b
OptionalAccess
a?.b
NullCoalesce
a ?? b
Call
func(args) or entity.method(args)
JoinLookup
Entity{field1, field2} or Entity{field: value}
BinaryOp
a + b, a - b, a * b, a / b
Comparison
a = b, a != b, a < b, a <= b, a > b, a >= b
LogicalOp
a and b, a or b
Not
not expr
In
x in collection
NotIn
x not in collection
Exists
exists expr
NotExists
not exists expr
Where
collection where condition
With
collection with predicate (in relationship declarations)
Pipe
a | b — pipe, used for inline enums and sum type discriminators
Lambda
x => body
Conditional
if cond: a else if cond: b else: c
For
for x in collection [where cond]: body
Fields
binding: ForBindingProjectionMap
collection where cond -> field — projection mapping
TransitionsTo
Entity.status transitions_to state
Becomes
Entity.status becomes state
Binding
name: expr — binding inside a clause value (when triggers, facing, context)
WhenGuard
action when condition — guard on a provides/related item
TypeOptional
T? — optional type annotation
LetExpr
let name = value inside an expression block (ensures, provides, etc.)
QualifiedName(QualifiedName)
oauth/Session — qualified name with module prefix
Block
A sequence of expressions from a multi-line block.