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>

source

pub fn ast_field(self) -> &'db Field

The AST node for the field.

source

pub fn composite_type(self) -> CompositeTypeWalker<'db>

The composite type containing the field.

source

pub fn documentation(&self) -> Option<&str>

The optional documentation string of the field.

source

pub fn mapped_name(self) -> Option<&'db str>

The name contained in the @map() attribute of the field, if any.

source

pub fn field_id(self) -> FieldId

The ID of the field in the AST.

source

pub fn name(self) -> &'db str

The name of the field.

source

pub fn arity(self) -> FieldArity

Is the field required, optional or a list?

source

pub fn type(self) -> ScalarFieldType

The type of the field, e.g. String in streetName String?.

source

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).

source

pub fn default_attribute(self) -> Option<&'db Attribute>

The @default() AST attribute on the field, if any.

source

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”, &[], )

source

pub fn default_value(self) -> Option<&'db Expression>

The value expression in the @default attribute.

score Int @default(0)
                   ^
source

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")
                                    ^^^^^^^^^^^^^^^^^^^^^^^^
source

pub fn database_name(self) -> &'db str

The final database name of the field. See crate docs for explanations on database names.