Struct parser_database::walkers::InlineRelationWalker
source · pub struct InlineRelationWalker<'db>(/* private fields */);
Expand description
An explicitly defined 1:1 or 1:n relation. The walker has the referencing side defined, but might miss the back relation in the AST.
Implementations§
source§impl<'db> InlineRelationWalker<'db>
impl<'db> InlineRelationWalker<'db>
sourcepub fn is_one_to_one(self) -> bool
pub fn is_one_to_one(self) -> bool
The relation is 1:1, having at most one record on both sides of the relation.
sourcepub fn referencing_model(self) -> ModelWalker<'db>
pub fn referencing_model(self) -> ModelWalker<'db>
The model which holds the relation arguments.
sourcepub fn referenced_model(self) -> ModelWalker<'db>
pub fn referenced_model(self) -> ModelWalker<'db>
The model referenced and which hold the back-relation field.
sourcepub fn as_complete(self) -> Option<CompleteInlineRelationWalker<'db>>
pub fn as_complete(self) -> Option<CompleteInlineRelationWalker<'db>>
If the relation is defined from both sides, convert to an explicit relation walker.
sourcepub fn referencing_fields(
self
) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>>>
pub fn referencing_fields( self ) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>>>
The referencing fields, from the forward relation field.
sourcepub fn referenced_fields(
self
) -> Box<dyn Iterator<Item = ScalarFieldWalker<'db>> + 'db>
pub fn referenced_fields( self ) -> Box<dyn Iterator<Item = ScalarFieldWalker<'db>> + 'db>
The referenced fields. Inferred or specified.
sourcepub fn forward_relation_field(self) -> Option<RelationFieldWalker<'db>>
pub fn forward_relation_field(self) -> Option<RelationFieldWalker<'db>>
The forward relation field (the relation field on model A, the referencing model).
sourcepub fn mapped_name(self) -> Option<&'db str>
pub fn mapped_name(self) -> Option<&'db str>
The contents of the map: ...
argument of the @relation
attribute.
sourcepub fn back_relation_field(self) -> Option<RelationFieldWalker<'db>>
pub fn back_relation_field(self) -> Option<RelationFieldWalker<'db>>
The back relation field, or virtual relation field (on model B, the referenced model).
sourcepub fn relation_id(self) -> RelationId
pub fn relation_id(self) -> RelationId
The unique identifier of the relation.
sourcepub fn explicit_relation_name(self) -> Option<&'db str>
pub fn explicit_relation_name(self) -> Option<&'db str>
The relation name in the schema.
myField OtherModel @relation("thisModelToOtherModel", fields: [fkfield], references: [id])
// ^^^^^^^^^^^^^^^^^^^^^^^
sourcepub fn relation_name(self) -> RelationName<'db>
pub fn relation_name(self) -> RelationName<'db>
The name of the relation. Either uses the name
(or default) argument,
or generates an implicit name.
Trait Implementations§
source§impl<'db> Clone for InlineRelationWalker<'db>
impl<'db> Clone for InlineRelationWalker<'db>
source§fn clone(&self) -> InlineRelationWalker<'db>
fn clone(&self) -> InlineRelationWalker<'db>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more