pub struct At<'a> { /* private fields */ }Expand description
Where a predicate is being applied: the path naming the column, and the row it constrains.
§Why the row travels with the column
ComplexComparison::apply already takes schema knowledge from its caller, and says why: the
name is rendered into the SQL text verbatim, and the caller owns it because the caller is the
only party that knows the schema. A row’s table and key columns are the same kind of knowledge,
so they arrive at the same place — and arriving HERE rather than at the crossing is what keeps
TryFromFilter taking a filter and nothing else.
That is not a tidiness argument. The addressing genuinely is not part of a filter:
tags: { overlaps: […] } is the same question whichever row it constrains, and only the address
differs. A crossing that took the address would be claiming otherwise — and a comparison built
from a filter alone can be applied against any row shape the caller names, which is the property
that makes a generated comparison reachable from a GraphQL filter at all.
§The top level is the EMPTY path, and that is the whole reason this is a path
A generated comparison is the composite case: it is handed one address and each of its columns
extends it. Under a single NAME there was no name to hand it that produced the right answer — a
top-level Media predicate rendered media_title where the column is title, and applying one
to its own row rendered frames_id beside a RecordAddress saying the column identifying
that row is id. The address and the predicate disagreed about one column inside one call, and
no naming convention reconciles them.
With a path there is nothing to reconcile: new names a row and no column, each
layer pushes its own segment, and title falls out of the top level rather than being a case.
§A comparison over a COLUMN applied at the top level addresses none
The empty path names no column, so what a backend renders for one is the backend’s — the SQL family writes nothing, which makes the predicate around it a parse error rather than a name that might resolve.
Writing nothing settles only the forms that WRITE the column. A CORRELATED comparison has one
that does not: its second table is the row’s own extended by the column’s path, and extended by
nothing it IS the row’s, so the predicate correlates the row to itself and is well-formed and
constant. Those kinds refuse the empty path outright — see
SqlLoweringError::EdgeWithoutField.
Either way a column’s comparison belongs at a frame, and frame is the only way
to make one.
§An address is a VALUE, and every receiver here says so
Two borrowed pointers and Copy, so an &At<'_> is a pointer to two pointers: the width of
what it points at, one indirection more, and the opposite of how the builder travels through the
very same signature. ComplexComparison::apply takes this BY VALUE for that reason, and the
three accessors take self rather than &self for the same one.
The receiver is measured rather than matched to a habit. The emitter writes its calls
qualified — At::frame(at, …) on the address its apply was handed — which against a &self
receiver is one E0308 per emitted column, ten of them across ingraph-derive’s fixtures,
reported at the #[derive] rather than anywhere inside the expansion a reader could look at. So
&self would cost generated code a & at each such site and buy nothing back; nothing anywhere
holds an At it cannot copy.
Implementations§
Source§impl<'a> At<'a>
impl<'a> At<'a>
Sourcepub const fn new(record: &'a RecordAddress) -> Self
pub const fn new(record: &'a RecordAddress) -> Self
The record row itself, at NO column — the TOP LEVEL, from which every column is a frame
below.
Depth ZERO and no alias, which is the base scope: the outermost FROM names the real table.
Every caller that had this signature keeps it, which is what let the two fields arrive without
touching a line of generated code.
Sourcepub const fn nested(
record: &'a RecordAddress,
enclosing: usize,
alias: &'static str,
) -> Self
pub const fn nested( record: &'a RecordAddress, enclosing: usize, alias: &'static str, ) -> Self
The record row as a nested scope sees it: one level deeper than enclosing, under the name
that level’s FROM gave it.
The row is the TARGET’s rather than the enclosing one’s — a relation descends into a different table — so the address is passed rather than derived, while the depth is the enclosing scope’s plus one because that is what nesting means.
§The alias is &'static str, and that is the whole reason this is expressible
It is minted at EXPANSION and reaches here off
SqlQuery::ALIASES, so it borrows nothing and adds no
lifetime. A runtime-built name could not be held by a Copy address at all, which is the
restriction RecordAddress’s note records — and the reason the table there is still the REAL
one: a dependent table’s name is DERIVED from it, so the two roles had to be split rather than
swapped.
Sourcepub const fn aliased(
record: &'a RecordAddress,
alias: &'static str,
keys: &'a [&'static FieldName],
) -> Self
pub const fn aliased( record: &'a RecordAddress, alias: &'static str, keys: &'a [&'static FieldName], ) -> Self
The record row as a row source the ENCLOSING FROM already named: at depth zero, under
alias, with its key columns projected under keys.
§It is the third shape, and a UNION’s derived table is what needed it
new says the outermost FROM names the real table and
nested says a subquery one level in renamed it. A derived table is neither:
( … ) AS "__ig_union__" is the statement’s OWN level — nothing is nested and the predicate is
the outer WHERE — and the row is under a name that is not its table’s. Spelling it as
nested would claim a scope that is not there, which is the axis a nesting kind indexes
SqlQuery::ALIASES with.
§The RECORD stays the member’s REAL one, and that is the whole of why this is safe
A dependent table’s name is DERIVED from the row’s real table —
edge_table extends it — so an address naming the alias
would name a table that does not exist, which is the hazard RecordAddress’s own note warns
of. Here the two roles are held apart: record is the member’s, so reel_marks derives; the
alias is the union’s, so a correlation compares against the name the enclosing FROM gave.
keys is the other half of the same split — see parent_keys.
Sourcepub const fn parent_keys(self) -> Option<&'a [&'static FieldName]>
pub const fn parent_keys(self) -> Option<&'a [&'static FieldName]>
What the enclosing scope calls this row’s KEY columns, where it does not call them by their own
names — and None where it does, which is every scope that selects the row’s own table.
§Two facts that were always two, spelled as one until a union broke the coincidence
A correlation compares an edge table’s parent-key column against the parent row’s. The FIRST is
named after the row’s own address column, because that is what the CREATE TABLE for the edge
wrote; the SECOND is named whatever the parent SCOPE projects it under. Selecting a real table
makes those one string, and every record’s lowering lived on that coincidence.
A union’s arms project each member’s address column AS "id", so the coincidence breaks: the
edge side wants the member’s own name and the parent side wants "id". This is where the
second fact is stated when it differs, POSITIONALLY against RecordAddress::keys — and a
shorter list leaves the columns past its end naming themselves, which is the answer None
gives for all of them.
Sourcepub const fn depth(self) -> usize
pub const fn depth(self) -> usize
How many correlated scopes enclose this one — zero at the statement’s own level, one inside a relation’s subquery, two inside a relation inside that.
It is what a nesting kind indexes SqlQuery::ALIASES
with, and depth is the right axis rather than an occurrence counter: an alias is scoped to the
subquery that states it, so two SIBLING subqueries may name their row sources alike and neither
can see the other’s. What must differ is a name and the name it nests inside.
Sourcepub const fn qualifier(self) -> &'a str
pub const fn qualifier(self) -> &'a str
The name a qualified reference to this row must use: the alias if the enclosing FROM gave
one, and otherwise the table’s own name.
§It is NOT RecordAddress::table, and the two are different questions
This one answers what is this row called HERE, which is what a correlation compares against.
The other answers what is this row’s table, which is what a dependent table’s name is derived
from — edge_table extends it, and extending an alias
would name a table that does not exist. Every qualifier reads this; every derivation reads
that.
A &str rather than a FieldName, because the two sources have different types and the
bracketing takes either: a table is a &'static FieldName and an alias a &'static str.
Sourcepub const fn path(self) -> Option<&'a Path<'a>>
pub const fn path(self) -> Option<&'a Path<'a>>
The segments naming the column this predicate is applied to, or None at the top level.
A Backend reads this to render one; nothing else has to, because a kind asks the backend
for the column rather than building the name itself.
Sourcepub const fn record(self) -> &'a RecordAddress
pub const fn record(self) -> &'a RecordAddress
The row this predicate constrains.
Sourcepub const fn top(self) -> Self
pub const fn top(self) -> Self
The same SCOPE at no column — this row’s top level, keeping the depth and the alias.
It is what a kind that opens a derived scope of its own hands the comparison inside it: the
element of a collection is addressed at the row’s top level framed by one segment, and the row
it belongs to is the row this address names, under the name this scope already calls it. An
At::new(at.record()) there would have reset both fields and correlated an inner predicate to
a table name the enclosing FROM had renamed.
Sourcepub const fn frame(self, name: &'a FieldName) -> Frame<'a>
pub const fn frame(self, name: &'a FieldName) -> Frame<'a>
The same row, one segment further down: bind the frame to a local, then address through
Frame::at.
Two lines rather than one, and the frame is the reason — the child address BORROWS its path from it, so the link has to live somewhere the child can point at, and the caller’s stack is the only place that costs nothing.
Trait Implementations§
impl<'a> Copy for At<'a>
impl<'a> Eq for At<'a>
impl<'a> StructuralPartialEq for At<'a>
Auto Trait Implementations§
impl<'a> Freeze for At<'a>
impl<'a> RefUnwindSafe for At<'a>
impl<'a> Send for At<'a>
impl<'a> Sync for At<'a>
impl<'a> Unpin for At<'a>
impl<'a> UnsafeUnpin for At<'a>
impl<'a> UnwindSafe for At<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<K> PositionKey for K
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> RootKey for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.