pub fn order_by(
header: &UnitHeader<'_>,
direction_ty: &TokenStream,
columns: &[OrderColumn],
) -> (TokenStream, TokenStream)Expand description
The ORDER-BY face: one variant per orderable column, each CARRYING its direction, plus the question every term answers whatever a database does with it.
§One value is one whole term
A query orders by a LIST of these, and the list is ordered by the GraphQL specification where an
input object’s fields are not: ORDER BY a, b is not ORDER BY b, a, so the sequence is carried
by the one structure the spec calls ordered. Two parallel lists — orderBy: [a, b], orderDirection: [desc] — is the shape this replaces, and the pairing is why: nothing in a type
system makes two lists the same length, so a mismatch is silently completed rather than refused.
The SHAPE is async-graphql’s OneofObject — an enum of single-value tuple variants — and that
derive is the backend’s, so it is not emitted here. What is emitted is the shape it takes.
An or-pattern in direction rather than an arm per variant, because every arm’s body is the
binding and nothing else. The EMPTY case is a subject that stores no column at all: the enum is
uninhabited there and the empty match is what a value of it can be taken apart into.