kw group
Contextual keyword — query expression (§5.9)
The list of words: §1.4
Syntax
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
- 10.5 Topics — cluster-wide fan-out — A topic is a distributed broadcast with storage in the built-in storage.
- 5.9 Query expressions — Form: from x in source (where e)\* (order by e (asc|desc)?, …)?
- 1.4 Keywords — Reserved (cannot be used as names)
Examples
@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
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())Related diagnostics
topic-without-journal, query-not-sql