Skip to main content

GraphqlField

Struct GraphqlField 

Source
pub struct GraphqlField {
    pub source: Ident,
    pub domain: Type,
    pub wire: Option<Type>,
    pub output_crossing: WirePosition,
    pub input_crossing: WirePosition,
    pub input: Face,
    pub output: Face,
    pub output_field: Option<Ident>,
}
Expand description

One field of the wire face, in both of its schema positions.

Fields§

§source: Ident

The RECORD field this projects.

§domain: Type

The record field’s declared type, verbatim.

§wire: Option<Type>

graphql(type = "…") — the WIRE FORM, when it is not the domain type.

ONE per field and DATABASE-INDEPENDENT, which is the whole of why it sits here rather than on a Face: a schema that varied with a deployment’s storage backend would be a schema no client could hold against two deployments. It serves both positions for the same reason — the operand a client filters with and the value it receives back are one type, and a client that had to know two would be reading a schema this framework should not be able to write.

§output_crossing: WirePosition

graphql(output(…)) — the crossings from each database’s ROW FIELD into the wire form, and the error a fallible one answers with.

§input_crossing: WirePosition

graphql(input(comparison(…))) — the crossings from the wire form into each database’s ROW FIELD, spent where a filter’s operand becomes a comparison’s.

§input: Face

The INPUT position’s SCHEMA facts: graphql(<backend>(input(…))).

§output: Face

The OUTPUT position’s SCHEMA facts: graphql(<backend>(output(…))).

Separate from GraphqlField::input because a GraphQL input field and an output field are different schema positions and may legitimately differ — in name and in the attributes they carry. They no longer differ in TYPE: see wire.

Its NAME is the client-visible one ALONE. What the emitted output struct READS the field through in Rust is GraphqlField::accessor, which is a separate axis — see that method.

§output_field: Option<Ident>

graphql(<backend>(output(field = "…"))) — the ACCESSOR the output object reads this field through, where the declaration moved it. None is the field’s own name.

HERE rather than on the output Face, and the reason is that a Face is a SCHEMA POSITION: both of its members are facts about what a client sees, and a Rust ident is not one. Sitting on the face would also put the slot in the INPUT position, where nothing could read it — the input face’s Rust spelling belongs to the FILTER, and it is the mangling of that face’s own name. An entry nobody reads is a rule its author believes they declared.

One slot rather than one per backend for the fact it states: there is ONE <E>GraphqlOutput per record, carrying whatever derives its declared backends need, so what its Rust face is called cannot be a backend’s business. The name a CLIENT sees can be, and that one is on the face.

Implementations§

Source§

impl GraphqlField

Source

pub const fn wire_ty(&self) -> &Type

The WIRE FORM this field takes: the declared one, or the domain type.

Source

pub const fn accessor(&self) -> &Ident

What the emitted OUTPUT OBJECT’s ACCESSOR for this field is named after: the declared word, else the DOMAIN name.

§Three layers, and this is layer TWO
writtenmoves
graphql(<backend>(output(rename = "…")))LAYER 3 — the client-visible name, and nothing in Rust
graphql(<backend>(output(field = "…")))LAYER 2 — this ACCESSOR, and neither the member nor anything a client sees
nothingthe client sees the backend’s own default rename (camelCase); Rust reads the domain name through the domain name

LAYER 1 — the emitted member — is source, and no word reaches it. That is the whole of what makes it a substrate: an emitted-to-emitted read spends the FIELD, so a crossing, an equation or an audit written against a member is written against a name no declaration can move, and divergence between what one expansion writes and what its neighbour reads is unspellable rather than guarded against.

What moves instead is the Rust FACE, which is where a rename belongs: a caller writing mass_ref() over a weight column is naming a METHOD, and a method is the layer a library gets to choose the spelling of. The word’s REACH changed; its grammar did not.

The Rust ident used to be taken from the output FACE’s name, which coupled two axes: a schema rename MOVED the struct’s field. That coupling is what the interface’s stored output face died on — an interface knows a member’s field by its DOMAIN name and by nothing else, so a member that renamed its schema field became unreadable to a contract it satisfies. Pinning the member to the domain name is the same fix carried to the one word that could still reach it.

The ONE place the default is resolved, and it has two readers rather than four now — this accessor and the emitted-method audit that enumerates it. The member and the row crossing that fills it read source, which is the fence made structural rather than agreed.

Trait Implementations§

Source§

impl Clone for GraphqlField

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 GraphqlField

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.