kw from
Contextual keyword — query expression (§5.9)
The list of words: §1.4
Syntax
SelArm = ( "recv" Pattern "from" Expr | "send" Expr "to" Expr | "after" Expr | "else" ) "=>" Expr ;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
- 5.9 Query expressions — Form: from x in source (where e)\* (order by e (asc|desc)?, …)?
- 10.5 Topics — cluster-wide fan-out — A topic is a distributed broadcast with storage in the built-in storage.
- 1.4 Keywords — Reserved (cannot be used as names)
- 8.9 Software transactional memory — atomic { … } executes the body as a serialisable transaction over TVars.
- 3.6 Aliases, new types and refined types — distinct T creates a new nominal type with the representation of T.
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
- 8.7 Channels and select — tx.send(x) suspends when the buffer is full; cap
- 9.2 Field numbers and schema — Every field of a data and every variant of an enum has a stable tag (the number in the wire format).
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())@retain(ORDER_EVENTS_RETENTION)
topic OrderEvents: OrderEvent sharded by .userId
emit OrderEvents(e) // publication
for await e in OrderEvents.subscribe(key: uid, from: .Latest) { … }
for await e in OrderEvents.subscribe(group: "indexer") { index(e) }— 10.5 Topics — cluster-wide fan-out
Related diagnostics
query-not-sql, topic-without-journal, atomic-effects, refinement-violated, bad-init, missing-field, must-close, positional-literal, sealed-literal, schema-attr, schema-break