Type Alias parser_database::walkers::RelationFieldWalker
source · pub type RelationFieldWalker<'db> = Walker<'db, RelationFieldId>;
Expand description
A relation field on a model in the schema.
Aliased Type§
struct RelationFieldWalker<'db> {
pub db: &'db ParserDatabase,
pub id: RelationFieldId,
}
Fields§
§db: &'db ParserDatabase
The parser database being traversed.
id: RelationFieldId
The identifier of the focused element.
Implementations§
source§impl<'db> RelationFieldWalker<'db>
impl<'db> RelationFieldWalker<'db>
sourcepub fn one_side_is_view(self) -> bool
pub fn one_side_is_view(self) -> bool
The relation starts or ends to a view.
sourcepub fn mapped_name(self) -> Option<&'db str>
pub fn mapped_name(self) -> Option<&'db str>
The foreign key name of the relation (@relation(map: ...)
).
sourcepub fn explicit_on_delete(self) -> Option<ReferentialAction>
pub fn explicit_on_delete(self) -> Option<ReferentialAction>
The onDelete argument on the relation.
sourcepub fn explicit_on_delete_span(self) -> Option<Span>
pub fn explicit_on_delete_span(self) -> Option<Span>
The onDelete argument on the relation.
sourcepub fn explicit_on_update(self) -> Option<ReferentialAction>
pub fn explicit_on_update(self) -> Option<ReferentialAction>
The onUpdate argument on the relation.
sourcepub fn explicit_on_update_span(self) -> Option<Span>
pub fn explicit_on_update_span(self) -> Option<Span>
The onUpdate argument on the relation.
sourcepub fn explicit_relation_name(self) -> Option<&'db str>
pub fn explicit_relation_name(self) -> Option<&'db str>
The relation name explicitly written in the schema source.
sourcepub fn is_ignored(self) -> bool
pub fn is_ignored(self) -> bool
Is there an @ignore
attribute on the field?
sourcepub fn is_required(self) -> bool
pub fn is_required(self) -> bool
Is the field required? (not optional, not list)
sourcepub fn model(self) -> ModelWalker<'db>
pub fn model(self) -> ModelWalker<'db>
The model containing the field.
sourcepub fn opposite_relation_field(self) -> Option<RelationFieldWalker<'db>>
pub fn opposite_relation_field(self) -> Option<RelationFieldWalker<'db>>
A valid relation is defined by two relation fields. This method returns the other relation field in the same relation.
sourcepub fn relation_attribute(self) -> Option<&'db Attribute>
pub fn relation_attribute(self) -> Option<&'db Attribute>
The @relation
attribute in the field AST.
sourcepub fn references_model(self, other: ModelId) -> bool
pub fn references_model(self, other: ModelId) -> bool
Does the relation field reference the passed in model?
The model referenced by the relation.
sourcepub fn referenced_fields(
self
) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>>>
pub fn referenced_fields( self ) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>>>
The fields in the @relation(references: ...)
argument.
sourcepub fn relation(self) -> RelationWalker<'db>
pub fn relation(self) -> RelationWalker<'db>
The relation this field is part of.
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.
sourcepub fn referential_arity(self) -> FieldArity
pub fn referential_arity(self) -> FieldArity
The arity to enforce, based on the arity of the fields. If any referencing field is required, this will be required.
Prisma allows setting the relation field as optional, even if one of the underlying scalar fields is required. For the purpose of referential actions, we count the relation field required if any of the underlying fields is required.
sourcepub fn references_singular_id_field(self) -> bool
pub fn references_singular_id_field(self) -> bool
Used for validation.
sourcepub fn referencing_fields(
self
) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>> + Clone>
pub fn referencing_fields( self ) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>> + Clone>
The fields in the fields: [...]
argument in the forward relation field.
sourcepub fn fields(
self
) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>> + Clone>
pub fn fields( self ) -> Option<impl ExactSizeIterator<Item = ScalarFieldWalker<'db>> + Clone>
The fields in the fields: [...]
argument in the forward relation field.