Expand description
Ordering and distinct input types.
Hasura orders with order_by: [<table>_order_by!] where each entry maps a
column to a direction drawn from one shared enum:
author(order_by: [{name: asc_nulls_last}, {id: desc}]) { id }A list rather than a single object, because ordering is ordered: {name: asc, id: desc} is one object whose two keys have no defined precedence,
and the client that wrote it meant name first.
The direction enum carries null placement, which the previous
orderBy: ["name.asc"] strings could not express at all. In PostgreSQL
nulls sort last ascending and first descending, so asc and
asc_nulls_last mean the same thing and asc_nulls_first does not –
which is exactly the case a client reaches for the enum to say.
distinct_on takes columns from a generated enum rather than strings, for
the same reason the boolean expressions do: an unknown column should be
refused by the client, not by the database.
Constants§
- DIRECTION_
ENUM - The name of the shared direction enum.
Functions§
- aggregate_
order_ by_ type_ name - The name of the input for ordering a row by an aggregate of its children.
- build_
inputs - The ordering input and column enum for every table.
- direction_
enum - The shared direction enum.
- direction_
sql - The SQL for a direction, or
Noneif it is not one. - function_
order_ by_ type_ name - The name of the input for ordering by one aggregate function’s results.
- order_
by_ type_ name - The name of a table’s ordering input.
- select_
column_ type_ name - The name of a table’s column enum.