Skip to main content

Graphql

Struct Graphql 

Source
pub struct Graphql {
    pub backends: Vec<GraphqlBackend>,
    pub input: RustSafeName,
    pub output: RustSafeName,
    pub key_output: RustSafeName,
    pub key_object: Option<String>,
    pub key_argument: Option<String>,
    pub filter: RustSafeName,
    pub plural: Option<String>,
    pub connection: Option<String>,
    pub edge: Option<String>,
    pub skipped: Vec<Ident>,
}
Expand description

The record’s WIRE face: which GraphQL backends render it, and what each one calls it.

Only the OUTPUT’s members need a per-field declaration. The tree fixes the rest — the key object is a mechanical projection of the key’s columns, the filter of the stored ones, and the ARGUMENT object mirrors the engine’s own find surface — so this carries the four names and the exposed fields, and nothing else.

Fields§

§backends: Vec<GraphqlBackend>

The declared backends, in the order they were written. Never empty, as Persist::backends is.

§input: RustSafeName

The ONE argument object — default_input_name, with no rename knob — filling Graphql::Input.

What a client SENDS: the filter, the order, and the page the engine’s own typestate admits. Its members mirror query::sql’s find surface rather than being invented here, which is what keeps a query a client can write from being one the engine has no lane for.

§output: RustSafeName

The ONE wire output — default_output_name unless output(rename = "…") named it, filling Graphql::Output. What a client receives when it queries this record’s fields, and the only per-field-authored GraphQL mapping there is.

A separate type rather than the record itself, and deliberately. The record is the type the PIPELINE moves, so a wire attribute on it publishes every declaration’s compute struct; and the exposure would run the wrong way round — a record’s fields are IN unless something says otherwise, where the marker rule opts NONE in and the declaration names what a client sees. The wire form is the second half: a field whose schema type is not its domain type (u64 → String) has nowhere on the record to be that, and this object’s accessors are exactly where it is.

See GraphqlKind::output_object for what the object is rendered BY — an #[Object] impl over the accessors, which is the layer output(field = "…") moves.

§key_output: RustSafeName

The ONE key output — default_key_output_name unless key(rename = "…") named it, filling GraphqlOutput::Key. MECHANICAL from the key’s columns, with no per-field declaration: a search or knn hit IS a Scored over K, and the search envelopes derive their wire shape from this, so without it a hit has nothing to render into.

§key_object: Option<String>

key(output(rename = "…")) — what the SCHEMA calls the address OBJECT, where a declaration named it outright. None is the base above resolved, which is what emit::wire’s published_key spells.

§A SECOND seat over one Rust type, and the two move different things

Self::key_output is the RUST name and moves with key(rename = "…"); that same word also re-bases the schema; this one replaces the schema half alone. The 2026-08-16 rename ruling separated them because an address publishes TWO schema names out of one Rust type — GraphQL keeps input and output in one namespace — so a single seat could re-base the pair but could never name either of them.

A String and not a RustSafeName for Self::connection’s reason, a few fields down: what this names lives in GraphQL’s flat namespace and has no Rust identifier behind it, so nothing is mangled and a Rust keyword is an ordinary word.

§key_argument: Option<String>

key(input(rename = "…")) — what the SCHEMA calls the address ARGUMENT object, the shape a client sends a COMPOUND address in.

Its neighbour’s kind and its neighbour’s fence. None is the base with Input on the end — the one blessed composition in this grammar, and why it is blessed is written at default_key_input_name. A ROOT’s address crosses inward as its id and mints no argument object at all, so on that shape the word is simply unspent.

§filter: RustSafeName

The ONE filter type — default_filter_name unless filter(rename = "…") named it.

One per record, not one per database, because a filter is a WIRE type: a client must never see a schema that varies with a deployment’s storage choice. Its RESOLUTION is per database — it crosses into each one’s *Comparison through the declared conversions — and that crossing is where storage enters, exactly once.

§plural: Option<String>

graphql(plural = "…") — THIS ENTITY’S PLURAL, in the declaration’s own word, or None where it wrote none and the pluraliser’s word stands.

§A WORD, and deliberately not a field name

The declaration corrects the LANGUAGE — the plural of Corpus is corpora — rather than naming one field, and that is why the fact is stored here instead of being consumed at the one place that read it first. THREE readers now, which is the whole point of storing it: the list FIELD, the page’s type name and one edge’s, so a declaration corrects the English once and gets corpora(…): CorporaConnection with CorporaEdge beside it. The user’s word for that property is 一起跟 — they follow together — and Self::connection carries the tower it is the base of. An aggregate would be the fourth reader and asks for nothing new.

The SPELLING it reaches a schema in is not this value: the word is a word, and each reader spells it for its own position — a field lowers the initial, a type name raises it. plural = "Corpora" and plural = "corpora" therefore reach one field and one pair of type names, whichever way a declaration wrote it.

§What is checked WHERE

The word is held to GraphQL’s Name grammar at the declaration, where the literal’s own span is, so an empty string or a 9lives refuses at the token that wrote it. What CANNOT be checked there is the derived word, whose input is the published output name — see RecordModel::degenerate_plural, which is the silence this option exists to answer.

§connection: Option<String>

connection(rename = "…") — what the SDL calls this record’s PAGE object, where a declaration took the knob.

The TOP of a three-tier naming tower, and None means the tiers below it decide: the base is Self::plural resolved — the same word the list field is named from — so a record that wrote nothing publishes <Plural>Connection and one that wrote plural = "corpora" publishes CorporaConnection, with no second correction to make. The user’s ruling of 2026-08-13 is where that came from and emit::queries is where it is spelled.

The base is NOT the Relay Cursor Connections specification’s <Node>Connection, and the trade is real: Relay, Apollo and every schema codegen recognise a page by the <Node>Connection / <Node>Edge / edges { node cursor } triple, and a plural-stemmed name exits the first two thirds of that. The ruling made the trade once for every record; a rename on top of it is a second, per-record exit, and the emitted doc prices each.

A SCHEMA WORD and not a Rust name, which is why it is a String where its four neighbours are RustSafeNames. Those name TYPES a declaring scope holds and can collide over; this names a type in one flat GraphQL namespace, and the Rust marker carrying it is emitted inside the wire face’s own anonymous const, where no declaration can see it. Nothing is mangled, so the word a declaration wrote is the word a client reads — and a Rust KEYWORD is an ordinary word here, which is the whole of why the grammar carries a literal rather than an ident.

§edge: Option<String>

edge(rename = "…") — what the SDL calls ONE element of that page. None is the same tower’s base with Edge on it.

Separate from Self::connection rather than derived from it, because the two are separate hooks in the library and a schema may want one moved and not the other: async-graphql resolves each through its own trait. They ride ONE tower and are covered independently — the user’s 对 一起跟 was about the tower, and their independence is about the top of it.

§skipped: Vec<Ident>

#[ingraph(graphql(skip))] — the fields withheld from EVERY wire vocabulary this record publishes, in declaration order.

§The word sweeps, and what it sweeps is every vocabulary a client can name the column in

The output object drops the accessor, the filter drops the member, and the order-by drops the variant — one word, and the column is unnameable from the wire in all three positions. A half-swept field is the failure worth designing against: a client that cannot READ a column but can ORDER by it reads the column’s order back out, one page at a time.

The COMPARISON is not among them and that is not an omission: it is the storage form of a predicate, emitted for a record with no wire face at all, so it belongs to the row rather than to the schema. What removes a column from a comparison is the storage word — skip, or one database’s own — which is the axis that owns the row.

A withheld field never becomes a GraphqlField, so the output object is swept by ABSENCE. This list is what the filter and the order-by read, both being one per record and built from the STORED columns rather than from the exposed ones.

Implementations§

Source§

impl Graphql

Source

pub fn publishes(&self, source: &Ident) -> bool

Whether this record publishes source on the wire at all — false where graphql(skip) withheld it.

The RECORD-wide question, which is the one the FILTER and the ORDER-BY ask: there is one of each per record — a client must never see a schema that varies with a deployment’s storage choice — so a per-backend answer would have no type to differ in.

§A withholding EVERY backend wrote is a record-wide one

The common word is the first way to reach that state and not the only one: a field no declared backend renders leaves no backend that still needs a seat for it, so the shared vocabularies have nothing to keep it for. The two spellings therefore reach one answer here, which is what makes the sweep TOTAL wherever it is total — with one backend shipped, graphql(async_graphql(skip)) and graphql(skip) say the same thing, and the ruling’s absent from that backend only is a distinction with one backend to draw it between.

What a PARTIAL withholding does — one backend of several — is that backend’s OUTPUT OBJECT and nothing else, the field never becoming one of its wire fields. The shared filter and order-by keep the member, because the backend that still renders it still needs one. That asymmetry is forced by the one-type-per-record law rather than chosen, and it is unreachable today: one backend ships.

Trait Implementations§

Source§

impl Clone for Graphql

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Graphql

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.