pub trait Entity {
// Required methods
fn id(&self) -> Option<&str>;
fn table_name() -> &'static str
where Self: Sized;
// Provided methods
fn is_deleted(&self) -> bool { ... }
fn created_at(&self) -> Option<NaiveDateTime> { ... }
fn updated_at(&self) -> Option<NaiveDateTime> { ... }
}Expand description
Generic entity trait that all repository entities must implement
Required Methods§
Sourcefn table_name() -> &'static strwhere
Self: Sized,
fn table_name() -> &'static strwhere
Self: Sized,
Get the table name for this entity
Provided Methods§
Sourcefn is_deleted(&self) -> bool
fn is_deleted(&self) -> bool
Check if entity is soft deleted
Sourcefn created_at(&self) -> Option<NaiveDateTime>
fn created_at(&self) -> Option<NaiveDateTime>
Get creation timestamp
Sourcefn updated_at(&self) -> Option<NaiveDateTime>
fn updated_at(&self) -> Option<NaiveDateTime>
Get update timestamp
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".