Query language
RAQ queries are serializable relational trees. Builder functions create the same node shapes accepted by the server implementations.
Relational operations
| Operation | Builder | Purpose |
|---|---|---|
| Source | relation(name) | Refer to a public catalog relation |
| Selection | where(input, predicate) | Keep rows matching a predicate |
| Projection | project(input, fields) | Select or compute output fields |
| Rename | rename(input, aliases) | Rename relation attributes |
| Order | order(input, ...items) | Sort rows with asc or desc |
| Limit | limit(input, count) | Bound the result |
| Join | join(left, right, on) | Combine two relations |
| Union | union(left, right) | Set union |
| Difference | difference(left, right) | Set difference |
| Intersection | intersect(left, right) | Set intersection |
The compact source(...) / query(...) form supports a small single-source shape with selection, projection, ordering, and limit.
Expressions
Use attr(name) and value(value) with:
eqgtandgteltandlteandandor
String predicates are supported for user-facing convenience. Relation-qualified join attributes such as "products.category_id == categories.category_id" are rewritten into the internal left/right join scope.
Execution and inspection
evaluate(query, scope)evaluates supported queries over local row arrays.compile(query)emits SQLite SQL and bound parameters.runQuery(endpoint, query)sends one query.runBatch(endpoint, queries)sends a batch.canonicalizeQuery(query)produces a stable identity.analyzeSemanticReuse(...)conservatively checks whether stored rows can answer another query.planQueryBatch(...)searches for useful shared work.
TypeScript model
QueryNode and ExprNode are discriminated unions covering the supported AST. The @raquery/query/typed entrypoint creates clients from generated public catalog schemas.