OxL Reference

kw in

Reserved keyword

The list of words: §1.4

Syntax

ebnf
For         = [ Label ":" ] [ "inline" ] "for" [ "await" ] Pattern "in" Expr [ "where" Expr ] Block ;
ebnf
Query       = "from" Pattern "in" Expr { "where" Expr } [ "order" "by" Ord { "," Ord } ]
              [ "group" "by" Expr "into" Ident ] [ "skip" Expr ] [ "take" Expr ]
              [ "load" "(" IdentList ")" ] [ "select" Expr ] ;

Grammar: App. A

Defined in

Examples

oxl
let top = from o in db.Order
  where o.userId == uid && o.total > MIN_TOTAL
  order by o.createdAt desc
  skip page * PAGE_SIZE
  take PAGE_SIZE
  load(items)

let names = from u in users where u.active select u.name   // in-memory List
let byRole = from u in users group by u.role into g select (g.key, g.count())

— 5.9 Query expressions

oxl
for u in users { … }
for (i, u) in users.enumerate() { … }
for i in 0..n where i % 2 == 0 { … }      // filter
for await msg in input { … }               // stream<T>
while cond { … }
while let x? = queue.pop() { … }
loop { if done { break result } }          // loop is an expression
'outer: for a in xs { for b in ys { if a == b { break 'outer } } }

— 5.6 Loops

Related diagnostics

query-not-sql, shard-count-clamped, table-schema, break-value, outside-loop, time-mix, yield-outside-stream, topic-without-journal

See also