pub struct EntityTypeMeta {Show 13 fields
pub type_id: TypeId,
pub type_name: Cow<'static, str>,
pub table_name: Cow<'static, str>,
pub properties: Vec<PropertyMeta>,
pub navigations: Vec<NavigationMeta>,
pub primary_keys: Vec<Cow<'static, str>>,
pub indexes: Vec<IndexMeta>,
pub foreign_keys: Vec<ForeignKeyMeta>,
pub checks: Vec<CheckMeta>,
pub table_options: TableOptions,
pub is_view: bool,
pub is_keyless: bool,
pub comment: Option<Cow<'static, str>>,
/* private fields */
}Expand description
Metadata describing an entity type.
Corresponds to EFCore’s IEntityType.
Fields§
§type_id: TypeIdThe Rust type identifier.
type_name: Cow<'static, str>The Rust struct name.
table_name: Cow<'static, str>The database table name.
properties: Vec<PropertyMeta>Properties (columns) of this entity.
Navigation properties (relationships) of this entity.
primary_keys: Vec<Cow<'static, str>>The name of the primary key property (simplified; multi-key via Vec<String> in practice).
indexes: Vec<IndexMeta>Declarative indexes: composite, unique, partial (filter), or expression.
foreign_keys: Vec<ForeignKeyMeta>Declared foreign keys (composite keys and scalar #[foreign_key] targets).
checks: Vec<CheckMeta>Table-level CHECK constraints.
table_options: TableOptionsMySQL table options.
is_view: boolMaps to a database view (ToView): excluded from table DDL.
is_keyless: boolKeyless entity (HasNoKey): no primary key; read-only projections/views.
comment: Option<Cow<'static, str>>Table/entity comment (HasComment).
Implementations§
Source§impl EntityTypeMeta
impl EntityTypeMeta
Sourcepub fn find_property(&self, field_name: &str) -> Option<&PropertyMeta>
pub fn find_property(&self, field_name: &str) -> Option<&PropertyMeta>
Find a property by field name.
Uses a lazily-built HashMap index for O(1) lookup instead of linear
scan. The index is cached for the lifetime of this EntityTypeMeta;
a cloned meta rebuilds its own index on first access.
Find a navigation by field name.
Uses a lazily-built HashMap index for O(1) lookup instead of linear
scan. The index is cached for the lifetime of this EntityTypeMeta;
a cloned meta rebuilds its own index on first access.
Sourcepub fn primary_key_property(&self) -> Option<&PropertyMeta>
pub fn primary_key_property(&self) -> Option<&PropertyMeta>
Get the primary key property.
Sourcepub fn mapped_scalar_properties(&self) -> impl Iterator<Item = &PropertyMeta>
pub fn mapped_scalar_properties(&self) -> impl Iterator<Item = &PropertyMeta>
Returns properties that are not navigation and not mapped.
Sourcepub fn writable_scalar_properties(&self) -> impl Iterator<Item = &PropertyMeta>
pub fn writable_scalar_properties(&self) -> impl Iterator<Item = &PropertyMeta>
Returns mapped properties that can be written by INSERT/UPDATE.
Computed/generated columns are readable but must never appear in INSERT/UPDATE (the database computes them).