Entity

Trait Entity 

Source
pub trait Entity {
    type PrimaryKey<'a>;

Show 19 methods // Required methods fn table_ref() -> &'static TableRef; fn columns() -> &'static [ColumnDef]; fn primary_key_def() -> impl ExactSizeIterator<Item = &'static ColumnDef>; fn unique_defs( ) -> impl ExactSizeIterator<Item = impl ExactSizeIterator<Item = &'static ColumnDef>>; fn from_row(row: RowLabeled) -> Result<Self> where Self: Sized; fn create_table<Exec: Executor>( executor: &mut Exec, if_not_exists: bool, create_schema: bool, ) -> impl Future<Output = Result<()>> + Send; fn drop_table<Exec: Executor>( executor: &mut Exec, if_exists: bool, drop_schema: bool, ) -> impl Future<Output = Result<()>> + Send; fn insert_one<Exec: Executor, E: Entity>( executor: &mut Exec, entity: &E, ) -> impl Future<Output = Result<RowsAffected>> + Send; fn insert_many<'a, Exec, It>( executor: &mut Exec, items: It, ) -> impl Future<Output = Result<RowsAffected>> + Send where Self: 'a, Exec: Executor, It: IntoIterator<Item = &'a Self> + Send; fn find_pk<Exec: Executor>( executor: &mut Exec, primary_key: &Self::PrimaryKey<'_>, ) -> impl Future<Output = Result<Option<Self>>> + Send where Self: Sized; fn find_many<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, limit: Option<u32>, ) -> impl Stream<Item = Result<Self>> + Send where Self: Sized; fn delete_one<Exec: Executor>( executor: &mut Exec, primary_key: Self::PrimaryKey<'_>, ) -> impl Future<Output = Result<RowsAffected>> + Send where Self: Sized; fn delete_many<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, ) -> impl Future<Output = Result<RowsAffected>> + Send where Self: Sized; fn row_filtered(&self) -> Box<[(&'static str, Value)]>; fn row_full(&self) -> Row; fn primary_key(&self) -> Self::PrimaryKey<'_>; // Provided methods fn find_one<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, ) -> impl Future<Output = Result<Option<Self>>> + Send where Self: Sized { ... } fn save<Exec: Executor>( &self, executor: &mut Exec, ) -> impl Future<Output = Result<()>> + Send where Self: Sized { ... } fn delete<Exec: Executor>( &self, executor: &mut Exec, ) -> impl Future<Output = Result<()>> + Send where Self: Sized { ... }
}

Required Associated Types§

Required Methods§

Source

fn table_ref() -> &'static TableRef

Source

fn columns() -> &'static [ColumnDef]

Source

fn primary_key_def() -> impl ExactSizeIterator<Item = &'static ColumnDef>

Source

fn unique_defs() -> impl ExactSizeIterator<Item = impl ExactSizeIterator<Item = &'static ColumnDef>>

Source

fn from_row(row: RowLabeled) -> Result<Self>
where Self: Sized,

Source

fn create_table<Exec: Executor>( executor: &mut Exec, if_not_exists: bool, create_schema: bool, ) -> impl Future<Output = Result<()>> + Send

Source

fn drop_table<Exec: Executor>( executor: &mut Exec, if_exists: bool, drop_schema: bool, ) -> impl Future<Output = Result<()>> + Send

Source

fn insert_one<Exec: Executor, E: Entity>( executor: &mut Exec, entity: &E, ) -> impl Future<Output = Result<RowsAffected>> + Send

Source

fn insert_many<'a, Exec, It>( executor: &mut Exec, items: It, ) -> impl Future<Output = Result<RowsAffected>> + Send
where Self: 'a, Exec: Executor, It: IntoIterator<Item = &'a Self> + Send,

Source

fn find_pk<Exec: Executor>( executor: &mut Exec, primary_key: &Self::PrimaryKey<'_>, ) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized,

Source

fn find_many<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, limit: Option<u32>, ) -> impl Stream<Item = Result<Self>> + Send
where Self: Sized,

Source

fn delete_one<Exec: Executor>( executor: &mut Exec, primary_key: Self::PrimaryKey<'_>, ) -> impl Future<Output = Result<RowsAffected>> + Send
where Self: Sized,

Source

fn delete_many<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, ) -> impl Future<Output = Result<RowsAffected>> + Send
where Self: Sized,

Source

fn row_filtered(&self) -> Box<[(&'static str, Value)]>

Source

fn row_full(&self) -> Row

Source

fn primary_key(&self) -> Self::PrimaryKey<'_>

Provided Methods§

Source

fn find_one<Exec: Executor, Expr: Expression>( executor: &mut Exec, condition: &Expr, ) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized,

Source

fn save<Exec: Executor>( &self, executor: &mut Exec, ) -> impl Future<Output = Result<()>> + Send
where Self: Sized,

Source

fn delete<Exec: Executor>( &self, executor: &mut Exec, ) -> impl Future<Output = Result<()>> + Send
where Self: Sized,

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.

Implementors§