Type Alias parser_database::walkers::CompositeTypeFieldWalker
source · pub type CompositeTypeFieldWalker<'db> = Walker<'db, (CompositeTypeId, FieldId)>;
Expand description
A field in a composite type.
Aliased Type§
struct CompositeTypeFieldWalker<'db> {
pub db: &'db ParserDatabase,
pub id: (CompositeTypeId, FieldId),
}
Fields§
§db: &'db ParserDatabase
The parser database being traversed.
id: (CompositeTypeId, FieldId)
The identifier of the focused element.
Implementations§
source§impl<'db> CompositeTypeFieldWalker<'db>
impl<'db> CompositeTypeFieldWalker<'db>
sourcepub fn composite_type(self) -> CompositeTypeWalker<'db>
pub fn composite_type(self) -> CompositeTypeWalker<'db>
The composite type containing the field.
sourcepub fn documentation(&self) -> Option<&str>
pub fn documentation(&self) -> Option<&str>
The optional documentation string of the field.
sourcepub fn mapped_name(self) -> Option<&'db str>
pub fn mapped_name(self) -> Option<&'db str>
The name contained in the @map()
attribute of the field, if any.
sourcepub fn arity(self) -> FieldArity
pub fn arity(self) -> FieldArity
Is the field required, optional or a list?
sourcepub fn type(self) -> ScalarFieldType
pub fn type(self) -> ScalarFieldType
The type of the field, e.g. String
in streetName String?
.
sourcepub fn scalar_type(self) -> Option<ScalarType>
pub fn scalar_type(self) -> Option<ScalarType>
The type of the field in case it is a scalar type (not an enum, not a composite type).
sourcepub fn default_attribute(self) -> Option<&'db Attribute>
pub fn default_attribute(self) -> Option<&'db Attribute>
The @default()
AST attribute on the field, if any.
sourcepub fn raw_native_type(
self
) -> Option<(&'db str, &'db str, &'db [String], Span)>
pub fn raw_native_type( self ) -> Option<(&'db str, &'db str, &'db [String], Span)>
(attribute scope, native type name, arguments, span)
For example: @db.Text
would translate to (“db”, “Text”, &[],
sourcepub fn default_value(self) -> Option<&'db Expression>
pub fn default_value(self) -> Option<&'db Expression>
The value expression in the @default
attribute.
score Int @default(0)
^
sourcepub fn default_mapped_name(self) -> Option<&'db str>
pub fn default_mapped_name(self) -> Option<&'db str>
The mapped name of the default value. Always None
in composite types at the moment.
name String @default("george", map: "name_default_to_george")
^^^^^^^^^^^^^^^^^^^^^^^^
sourcepub fn database_name(self) -> &'db str
pub fn database_name(self) -> &'db str
The final database name of the field. See crate docs for explanations on database names.