kw in
Reserved keyword
The list of words: §1.4
Syntax
For = [ Label ":" ] [ "inline" ] "for" [ "await" ] Pattern "in" Expr [ "where" Expr ] Block ;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
- 12.8 Built-in storage and tables — The storage is on every node of the journal role, replication is Raft per shard.
- 5.9 Query expressions — Form: from x in source (where e)\* (order by e (asc|desc)?, …)?
- 5.6 Loops — for accepts Iterable<T> (including iter<T>, collections, ranges); for await accepts Streamable<T>.
- 10.4 Broadcast — local fan-out — Broadcast<T> delivers every published item to all current subscribers.
- 17.2 Arithmetic — Time ± Duration → Time, Time − Time → Duration, Instant − Instant → Duration.
- 10.3 Streams — The type is stream<T, E = never>.
- 10.5 Topics — cluster-wide fan-out — A topic is a distributed broadcast with storage in the built-in storage.
- 17.1 Types — Types
Examples
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())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 } } }Related diagnostics
query-not-sql, shard-count-clamped, table-schema, break-value, outside-loop, time-mix, yield-outside-stream, topic-without-journal