kw order
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
- 2.4 Entry points and start-up order — A program is a package that contains at least one of
- 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)
- 12.8 Built-in storage and tables — The storage is on every node of the journal role, replication is Raft per shard.
- 11.2 Database transaction — The body is executed in a transaction of the database db.
- 18.1 Test declaration — Form: attributes* test kind?
- 18.2 Assertions and fixtures — assert expr is executed in all profiles, including prod (profiles switch off only contracts, §6.7, and the output of dbg, §2.2); on failure
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())atomic(db) {
db.insert(order)
db.update(User, uid) { ordersCount += 1 }
emit OrderEvents(OrderEvent.Created(order.id))
}Related diagnostics
no-entry-point, query-not-sql, shard-count-clamped, table-schema, atomic-db-effects, cross-shard-tx, test-decl, fixture-yield