pub trait InsertableEntity {
type SourceEntity;
// Required method
fn insert<'a>(
&self,
executor: impl PgExecutor<'a>,
) -> impl Future<Output = Result<Self::SourceEntity, Error>>;
}
Expand description
Trait for types that can be inserted into the database. An “Insertable” struct is generated for each entity, containing only the fields that should be provided on insert.
Required Associated Types§
Sourcetype SourceEntity
type SourceEntity
The entity type returned after insertion (typically the main entity struct).
Required Methods§
Sourcefn insert<'a>(
&self,
executor: impl PgExecutor<'a>,
) -> impl Future<Output = Result<Self::SourceEntity, Error>>
fn insert<'a>( &self, executor: impl PgExecutor<'a>, ) -> impl Future<Output = Result<Self::SourceEntity, Error>>
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.