Trait atmosphere::Create

source ·
pub trait Create: Table + Bind + Hooks + Sync + 'static {
    // Required method
    fn create<'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;
}
Expand description

Trait for creating rows in a database.

This trait provides the functionality to create new rows in a table represented by a struct implementing Table, Bind, and Hooks. It defines an asynchronous method for inserting a new row into the database using a given executor. The trait ensures that all necessary hooks are executed at the appropriate stages of the operation.

Required Methods§

source

fn create<'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,

Creates a new row in the database. This method builds the SQL insert query, binds the necessary values, executes the query, and triggers the relevant hooks at different stages (pre-binding and post-execution).

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Create for T
where T: Table + Bind + Hooks + Sync + 'static,