#[non_exhaustive]pub struct DeclaredRelationship {
pub name: String,
pub using: Option<String>,
pub table: Option<String>,
pub columns: BTreeMap<String, String>,
pub to_one: bool,
pub after_parent: bool,
}Expand description
One relationship metadata declares, and how it is reached.
Either by a key reflection already found – using names the constraint or
the column, the same spellings TableNames::relationships accepts – or
by a column mapping, which is a join no key describes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe field name this relationship is exposed under.
using: Option<String>The key it is reached by, where it is reached by one.
table: Option<String>The table it points at, as schema.table, for a mapped join.
columns: BTreeMap<String, String>The join, as this table’s column to the other table’s column.
to_one: boolWhether it yields one row rather than many.
A key says this for itself; a column mapping does not, which is why Hasura declares object and array relationships separately.
after_parent: boolWhether a nested insert writes this row after the row it hangs off.
A key says which side holds it: article.author_id references
author, so the author is written first and its key fills the
article’s column. A column mapping says only that two columns are
equal, and author.id = author_detail.id is equal in both directions
– so which row can be written first is not recoverable from it, and
Hasura writes insertion_order down for exactly that reason.
false is before_parent, which is what an object relationship means
without being told otherwise. Ignored for a relationship to many,
which can only be written after the row it hangs off.
Implementations§
Trait Implementations§
Source§impl Clone for DeclaredRelationship
impl Clone for DeclaredRelationship
Source§impl Debug for DeclaredRelationship
impl Debug for DeclaredRelationship
Source§impl Default for DeclaredRelationship
impl Default for DeclaredRelationship
Source§impl<'de> Deserialize<'de> for DeclaredRelationship
impl<'de> Deserialize<'de> for DeclaredRelationship
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DeclaredRelationship
impl PartialEq for DeclaredRelationship
Source§impl Serialize for DeclaredRelationship
impl Serialize for DeclaredRelationship
impl StructuralPartialEq for DeclaredRelationship
Auto Trait Implementations§
impl Freeze for DeclaredRelationship
impl RefUnwindSafe for DeclaredRelationship
impl Send for DeclaredRelationship
impl Sync for DeclaredRelationship
impl Unpin for DeclaredRelationship
impl UnsafeUnpin for DeclaredRelationship
impl UnwindSafe for DeclaredRelationship
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more