Struct diesel::query_builder::insert_statement::InsertStatement
[−]
[src]
pub struct InsertStatement<T, U, Op = Insert, Ret = NoReturningClause> { /* fields omitted */ }
Methods
impl<T, U, Op, Ret> InsertStatement<T, U, Op, Ret>
[src]
fn new(target: T, records: U, operator: Op, returning: Ret) -> Self
impl<T, U, Op> InsertStatement<T, U, Op, NoReturningClause>
[src]
fn returning<E>(self,
returns: E)
-> InsertStatement<T, U, Op, ReturningClause<E>> where InsertStatement<T, U, Op, ReturningClause<E>>: Query
returns: E)
-> InsertStatement<T, U, Op, ReturningClause<E>> where InsertStatement<T, U, Op, ReturningClause<E>>: Query
Specify what expression is returned after execution of the insert
.
This method can only be called once.
Examples
Inserting a record:
let new_user = NewUser { name: "Timmy".to_string(), }; let inserted_name = diesel::insert(&new_user) .into(users) .returning(name) .get_result(&connection); assert_eq!(Ok("Timmy".to_string()), inserted_name);
Trait Implementations
impl<T: Clone, U: Clone, Op: Clone, Ret: Clone> Clone for InsertStatement<T, U, Op, Ret>
[src]
fn clone(&self) -> InsertStatement<T, U, Op, Ret>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Copy, U: Copy, Op: Copy, Ret: Copy> Copy for InsertStatement<T, U, Op, Ret>
[src]
impl<T: Debug, U: Debug, Op: Debug, Ret: Debug> Debug for InsertStatement<T, U, Op, Ret>
[src]
impl<T, U, Op, Ret, DB> QueryFragment<DB> for InsertStatement<T, U, Op, Ret> where DB: Backend,
T: Table,
T::FromClause: QueryFragment<DB>,
U: Insertable<T, DB> + Copy,
Op: QueryFragment<DB>,
Ret: QueryFragment<DB>
[src]
T: Table,
T::FromClause: QueryFragment<DB>,
U: Insertable<T, DB> + Copy,
Op: QueryFragment<DB>,
Ret: QueryFragment<DB>
fn to_sql(&self, out: &mut DB::QueryBuilder) -> BuildQueryResult
fn collect_binds(&self, out: &mut DB::BindCollector) -> QueryResult<()>
fn is_safe_to_cache_prepared(&self) -> bool
impl<T, U, Op, Ret> QueryId for InsertStatement<T, U, Op, Ret>
[src]
impl<T, U, Op> AsQuery for InsertStatement<T, U, Op, NoReturningClause> where T: Table,
InsertStatement<T, U, Op, ReturningClause<T::AllColumns>>: Query
[src]
InsertStatement<T, U, Op, ReturningClause<T::AllColumns>>: Query