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: IdentThe RECORD field this projects.
domain: TypeThe 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: WirePositiongraphql(output(…)) — the crossings from each database’s ROW FIELD into the wire form, and
the error a fallible one answers with.
input_crossing: WirePositiongraphql(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: FaceThe INPUT position’s SCHEMA facts: graphql(<backend>(input(…))).
output: FaceThe 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
impl GraphqlField
Sourcepub const fn wire_ty(&self) -> &Type
pub const fn wire_ty(&self) -> &Type
The WIRE FORM this field takes: the declared one, or the domain type.
Sourcepub const fn accessor(&self) -> &Ident
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
| written | moves |
|---|---|
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 |
| nothing | the 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.