Trait atmosphere::Delete

source ·
pub trait Delete: Table + Bind + Hooks + Send + Sync + Unpin + 'static {
    // Required methods
    fn delete<'e, 'life0, 'async_trait, E>(
        &'life0 mut self,
        executor: E
    ) -> Pin<Box<dyn Future<Output = Result<<Postgres as Database>::QueryResult, Error>> + Send + 'async_trait>>
       where 'e: 'async_trait,
             'life0: 'async_trait,
             E: Executor<'e, Database = Postgres> + 'async_trait,
             <Postgres as HasArguments<'q>>::Arguments: for<'q> IntoArguments<'q, Postgres> + for<'q> Send,
             Self: 'async_trait;
    fn delete_by<'e, 'life0, 'async_trait, E>(
        pk: &'life0 Self::PrimaryKey,
        executor: E
    ) -> Pin<Box<dyn Future<Output = Result<<Postgres as Database>::QueryResult, Error>> + Send + 'async_trait>>
       where 'e: 'async_trait,
             'life0: 'async_trait,
             E: Executor<'e, Database = Postgres> + 'async_trait,
             <Postgres as HasArguments<'q>>::Arguments: for<'q> IntoArguments<'q, Postgres> + for<'q> Send,
             Self: 'async_trait;
}
Expand description

Trait for deleting rows from a database.

Provides functionality for deleting rows from a table in the database. Implementors of this trait can delete entities either by their instance or by their primary key. The trait ensures proper execution of hooks at various stages of the delete operation, enhancing flexibility and allowing for custom behavior during the deletion process.

Required Methods§

source

fn delete<'e, 'life0, 'async_trait, E>( &'life0 mut self, executor: E ) -> Pin<Box<dyn Future<Output = Result<<Postgres as Database>::QueryResult, Error>> + Send + 'async_trait>>
where 'e: 'async_trait, 'life0: 'async_trait, E: Executor<'e, Database = Postgres> + 'async_trait, <Postgres as HasArguments<'q>>::Arguments: for<'q> IntoArguments<'q, Postgres> + for<'q> Send, Self: 'async_trait,

Deletes the row represented by the instance from the database. Builds and executes a delete query and triggers hooks at appropriate stages (e.g., before binding, before execution, after execution).

source

fn delete_by<'e, 'life0, 'async_trait, E>( pk: &'life0 Self::PrimaryKey, executor: E ) -> Pin<Box<dyn Future<Output = Result<<Postgres as Database>::QueryResult, Error>> + Send + 'async_trait>>
where 'e: 'async_trait, 'life0: 'async_trait, E: Executor<'e, Database = Postgres> + 'async_trait, <Postgres as HasArguments<'q>>::Arguments: for<'q> IntoArguments<'q, Postgres> + for<'q> Send, Self: 'async_trait,

Deletes a row from the database based on its primary key. This method is particularly useful for deleting entities when only the primary key is available.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Delete for T
where T: Table + Bind + Hooks + Send + Sync + Unpin + 'static,