pub trait ModelTrait:
Clone
+ Send
+ Debug {
type Entity: EntityTrait;
// Required methods
fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> Value;
fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value);
// Provided methods
fn find_related<R>(&self, _: R) -> Select<R>
where R: EntityTrait,
Self::Entity: Related<R> { ... }
fn find_linked<L>(&self, l: L) -> Select<L::ToEntity>
where L: Linked<FromEntity = Self::Entity> { ... }
fn delete<'a, 'async_trait, A, C>(
self,
db: &'a C,
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>
where Self: IntoActiveModel<A> + 'async_trait,
C: ConnectionTrait + 'async_trait,
A: ActiveModelTrait<Entity = Self::Entity> + ActiveModelBehavior + Send + 'a + 'async_trait,
'a: 'async_trait { ... }
}
Expand description
A Trait for a Model
Required Associated Types§
type Entity: EntityTrait
Required Methods§
Provided Methods§
Find related Models
Sourcefn find_linked<L>(&self, l: L) -> Select<L::ToEntity>
fn find_linked<L>(&self, l: L) -> Select<L::ToEntity>
Find linked Models
Sourcefn delete<'a, 'async_trait, A, C>(
self,
db: &'a C,
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>where
Self: IntoActiveModel<A> + 'async_trait,
C: ConnectionTrait + 'async_trait,
A: ActiveModelTrait<Entity = Self::Entity> + ActiveModelBehavior + Send + 'a + 'async_trait,
'a: 'async_trait,
fn delete<'a, 'async_trait, A, C>(
self,
db: &'a C,
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>where
Self: IntoActiveModel<A> + 'async_trait,
C: ConnectionTrait + 'async_trait,
A: ActiveModelTrait<Entity = Self::Entity> + ActiveModelBehavior + Send + 'a + 'async_trait,
'a: 'async_trait,
Delete a model
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.