pub trait Model {
type Default;
const DEFAULT: Self::Default;
// Required methods
async fn create_using_self(&mut self, pool: &SqlitePool) -> Result<()>;
async fn get_using_id(pool: &SqlitePool, id: i64) -> Result<Self>
where Self: Sized;
async fn update_using_self(&self, pool: &SqlitePool) -> Result<()>;
async fn delete_using_id(pool: &SqlitePool, id: i64) -> Result<()>;
}Required Associated Constants§
Required Associated Types§
Required Methods§
Sourceasync fn create_using_self(&mut self, pool: &SqlitePool) -> Result<()>
async fn create_using_self(&mut self, pool: &SqlitePool) -> Result<()>
Add model to database using self, mutating self with the returned id
Sourceasync fn get_using_id(pool: &SqlitePool, id: i64) -> Result<Self>where
Self: Sized,
async fn get_using_id(pool: &SqlitePool, id: i64) -> Result<Self>where
Self: Sized,
Get model from database using id
Sourceasync fn update_using_self(&self, pool: &SqlitePool) -> Result<()>
async fn update_using_self(&self, pool: &SqlitePool) -> Result<()>
Update model in database using self
Sourceasync fn delete_using_id(pool: &SqlitePool, id: i64) -> Result<()>
async fn delete_using_id(pool: &SqlitePool, id: i64) -> Result<()>
Delete model from database using id
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".