Create

Trait 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<<Driver as Database>::QueryResult>> + Send + 'async_trait>>
       where E: Executor<'e, Database = Driver> + 'async_trait,
             for<'q> <Driver as Database>::Arguments<'q>: IntoArguments<'q, Driver> + Send,
             Self: 'async_trait,
             'e: 'async_trait,
             'life0: '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<<Driver as Database>::QueryResult>> + Send + 'async_trait>>
where E: Executor<'e, Database = Driver> + 'async_trait, for<'q> <Driver as Database>::Arguments<'q>: IntoArguments<'q, Driver> + Send, Self: 'async_trait, 'e: 'async_trait, 'life0: '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).

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§

Source§

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