pub enum Model {
Root(ModelRoot),
EmbeddedStruct(EmbeddedStruct),
EmbeddedEnum(EmbeddedEnum),
}Variants§
Root(ModelRoot)
Root model that maps to a database table and can be queried directly
EmbeddedStruct(EmbeddedStruct)
Embedded struct model that is flattened into its parent model’s table
EmbeddedEnum(EmbeddedEnum)
Embedded enum model stored as a discriminant integer column
Implementations§
Source§impl Model
impl Model
pub fn id(&self) -> ModelId
pub fn name(&self) -> &Name
Sourcepub fn is_root(&self) -> bool
pub fn is_root(&self) -> bool
Returns true if this is a root model (has a table and primary key)
Sourcepub fn is_embedded(&self) -> bool
pub fn is_embedded(&self) -> bool
Returns true if this is an embedded model (flattened into parent)
Sourcepub fn can_be_relation_target(&self) -> bool
pub fn can_be_relation_target(&self) -> bool
Returns true if this model can be the target of a relation
pub fn as_root(&self) -> Option<&ModelRoot>
Sourcepub fn expect_root(&self) -> &ModelRoot
pub fn expect_root(&self) -> &ModelRoot
Returns a reference to the root model data, panicking if this is not a root model.
Sourcepub fn expect_root_mut(&mut self) -> &mut ModelRoot
pub fn expect_root_mut(&mut self) -> &mut ModelRoot
Returns a mutable reference to the root model data, panicking if this is not a root model.
Sourcepub fn expect_embedded_struct(&self) -> &EmbeddedStruct
pub fn expect_embedded_struct(&self) -> &EmbeddedStruct
Returns a reference to the embedded struct data, panicking if this is not an embedded struct.
Sourcepub fn expect_embedded_enum(&self) -> &EmbeddedEnum
pub fn expect_embedded_enum(&self) -> &EmbeddedEnum
Returns a reference to the embedded enum data, panicking if this is not an embedded enum.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more