ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
//! The storage side of an ORDER: the level sequence a wire term expands into, and the crossing an
//! emitted order makes to reach one.
//!
//! ```text
//! wire     [MediaOrderBy!]        → one word per citizen, one direction each
//! crossing FromGraphqlOrderBy     → the 乙 expansion, once
//! storage  <Record<Db>>::OrderBy  → ORDER BY "at_nanos", "at_pts", "at_timebase_num", …
//! ```
//!
//! It is [`comparison`](crate::comparison)'s module one axis over, and the parallel is the design
//! rather than a resemblance. A FILTER is the client's vocabulary — one per record, holding domain
//! values — and a COMPARISON is the storage's, one per (record × backend); the crossing between them
//! happens exactly once. An ORDER is the same split: the wire order is one per record and names a
//! CITIZEN per word, the storage order is one per (record × backend) and names a COLUMN per level,
//! and the expansion from the one to the other happens exactly once, here.
//!
//! # What the split buys, and why the wire word count does not move
//!
//! A composite citizen is ONE word on the wire — `orderBy: [{ at: ASC }]` — whatever it is stored
//! in. That is the full-form law read at the ordering seam: a client orders by an INSTANT, not by
//! the four columns an instant happens to occupy, and a schema that published the four would make a
//! client's query depend on a storage decision it cannot see. The crossing is where the one word
//! becomes those four, and the SEQUENCE it becomes them in is the citizen's own semantics.
//!
//! # The neutral pieces
//!
//! - [`OrderLevel`] — one level of the order a term runs in, as an ordinal into the column type's
//!   own segment tree. An ordinal rather than a name, because a leaf's column NAME is
//!   [`Backend::write_column`](crate::Backend::write_column)'s single join and a second speller
//!   would be the first thing to drift from it.
//! - [`ToDatabaseOrderBy<Db>`] — the type-level map from an INTERPRETATION to the leaves one term
//!   over it sorts by, at one backend. Marker-keyed, for
//!   [`ToGraphqlFilter`](crate::ToGraphqlFilter)'s reason: a type does not determine its own
//!   reading.
//! - [`ToCrossedOrderBy<Db>`] — that map refined to the two questions a lowering asks it, so the
//!   empty-sequence convention is held in one place rather than at every call site.
//! - [`FromGraphqlOrderBy<O>`] / [`TryFromGraphqlOrderBy<O>`] — the crossing itself, shaped like
//!   [`From`]/[`TryFrom`] and related by the same blanket, exactly as
//!   [`FromFilter`](crate::FromFilter) and [`TryFromFilter`](crate::TryFromFilter) are.
//! - [`ToOrderLeaves`] — the VALUE one of those LEVELS compares, which is what a cursor slot holds.
//!   Marker-keyed like the map above it and free of `Db`, a leaf's Rust type being the citizen's
//!   rather than a dialect's. What it selects is the citizen's own, at
//!   [`OrderLeaves`](crate::OrderLeaves).
//!
//! # Where the SEQUENCE is declared, and where it is not
//!
//! On the type, at [`ColumnKind::ORDER`](crate::ColumnKind::ORDER), beside the
//! [`SEGMENTS`](crate::ColumnKind::SEGMENTS) it permutes. Not in this module's rows and not in any
//! emitter: what a composite MEANS is the composite's own, so a citizen teaches its order by
//! overriding one const in an impl it already writes, and no framework table has to grow a row for
//! it. The map READS that answer; it does not hold it.
//!
//! # How a sequence is RENDERED: one term becomes one ordinary term per level
//!
//! A term over a reading that states a sequence EXPANDS —
//! [`OrderTerm::levels`](crate::OrderTerm::levels) — into one ordinary term per level, each naming
//! ONE leaf and carrying the whole term's direction. Nothing downstream of that is
//! composite-shaped: the `ORDER BY` renders one entry per level as it always did, the keyset writes
//! its per-level expansion with each level's operand binding one placeholder through the leaf type's
//! own scalar [`Carrier`](crate::Carrier) row, and the arm a boundary cut at a beyond-ceiling row
//! needs — `at_nanos IS NOT NULL OR (at_nanos IS NULL AND …)` — falls out of the general expansion
//! rather than being a case anyone writes. That is what the ruling bought by taking road A: the
//! sequence, the bind, the per-leaf `NULL` placement and the boundary arm all move at once because
//! they are all one thing, an ordinary level.
//!
//! A reading that states NO sequence does not expand and is byte-identical to what it always
//! rendered — the empty-sequence convention meaning *as declared* at the renderer exactly as it
//! means it at the map.

mod convert;
mod leaves;
mod lower;

pub use convert::{FromGraphqlOrderBy, TryFromGraphqlOrderBy};
pub use leaves::ToOrderLeaves;
pub use lower::{OrderLevel, ToCrossedOrderBy, ToDatabaseOrderBy};