pub trait Model:
Register
+ Load<Output = Self>
+ Sized {
type Query;
type Create: Default + IntoInsert<Model = Self> + IntoExpr<Self>;
type Update<'a>;
type UpdateQuery;
type Path<Origin>;
// Required method
fn new_path<Origin>(path: Path<Origin, Self>) -> Self::Path<Origin>;
// Provided methods
fn new_root_path() -> Self::Path<Self> { ... }
fn new_create() -> Self::Create { ... }
}Expand description
Trait for root models that map to database tables and can be queried.
Root models have primary keys, can be queried independently, and support
full CRUD operations. They extend Register with queryability and
deserialization capabilities.
Required Associated Types§
Sourcetype Create: Default + IntoInsert<Model = Self> + IntoExpr<Self>
type Create: Default + IntoInsert<Model = Self> + IntoExpr<Self>
Create builder type for this model
Sourcetype UpdateQuery
type UpdateQuery
Update by query builder type for this model
Required Methods§
Provided Methods§
Sourcefn new_root_path() -> Self::Path<Self>
fn new_root_path() -> Self::Path<Self>
Construct a path rooted at this model.
Sourcefn new_create() -> Self::Create
fn new_create() -> Self::Create
Return a fresh, default-initialized create builder.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.