Skip to main content

InsertQueryBook

Trait InsertQueryBook 

Source
pub trait InsertQueryBook<T: SqlEntity>: QueryBook<T> {
    // Provided methods
    fn get_sql_definition(&self) -> &'static str { ... }
    fn insert<'a>(
        &self,
        values: HashMap<&'a str, &'a dyn ToSqlAny>,
    ) -> SqlQuery<'a, T> { ... }
}
Expand description

A trait that marks QueryBooks that perform SQL insert queries. These queries actually return the inserted entities.

Provided Methods§

Source

fn get_sql_definition(&self) -> &'static str

Definition of the insert query.

Source

fn insert<'a>( &self, values: HashMap<&'a str, &'a dyn ToSqlAny>, ) -> SqlQuery<'a, T>

Create a new insert query with the given values. The query will be built using the definition returned by the get_sql_definition method. The source will be the source returned by the get_sql_source method. The structure will be the structure of the entity returned by the get_structure method. The values will be the values passed to the method. The projection will be the projection of the entity returned by the get_projection method.

Implementors§