Query language

RAQ queries are serializable relational trees. Builder functions create the same node shapes accepted by the server implementations.

Relational operations

OperationBuilderPurpose
Sourcerelation(name)Refer to a public catalog relation
Selectionwhere(input, predicate)Keep rows matching a predicate
Projectionproject(input, fields)Select or compute output fields
Renamerename(input, aliases)Rename relation attributes
Orderorder(input, ...items)Sort rows with asc or desc
Limitlimit(input, count)Bound the result
Joinjoin(left, right, on)Combine two relations
Unionunion(left, right)Set union
Differencedifference(left, right)Set difference
Intersectionintersect(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:

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

TypeScript model

QueryNode and ExprNode are discriminated unions covering the supported AST. The @raquery/query/typed entrypoint creates clients from generated public catalog schemas.