Type Alias parser_database::walkers::RelationWalker
source · pub type RelationWalker<'db> = Walker<'db, RelationId>;
Expand description
A relation that has the minimal amount of information for us to create one. Useful for validation purposes. Holds all possible relation types.
Aliased Type§
struct RelationWalker<'db> {
pub db: &'db ParserDatabase,
pub id: RelationId,
}
Fields§
§db: &'db ParserDatabase
The parser database being traversed.
id: RelationId
The identifier of the focused element.
Implementations§
source§impl<'db> RelationWalker<'db>
impl<'db> RelationWalker<'db>
sourcepub fn models(self) -> [ModelId; 2]
pub fn models(self) -> [ModelId; 2]
The models at each end of the relation. [model A, model B]. Can be the same model twice.
sourcepub fn relation_fields(self) -> impl Iterator<Item = RelationFieldWalker<'db>>
pub fn relation_fields(self) -> impl Iterator<Item = RelationFieldWalker<'db>>
The relation fields that define the relation. A then B.
sourcepub fn is_ignored(self) -> bool
pub fn is_ignored(self) -> bool
Is any field part of the relation ignored (@ignore
) or unsupported?
sourcepub fn is_self_relation(self) -> bool
pub fn is_self_relation(self) -> bool
Is this a relation where both ends are the same model?
sourcepub fn refine(self) -> RefinedRelationWalker<'db>
pub fn refine(self) -> RefinedRelationWalker<'db>
Converts the walker to either an implicit many to many, or a inline relation walker gathering 1:1 and 1:n relations.
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 relation name, explicit or inferred.
ⓘ
posts Post[] @relation("UserPosts")
^^^^^^^^^^^