Struct diesel::query_builder::insert_statement::InsertStatement [] [src]

pub struct InsertStatement<T, U, Op> {
    // some fields omitted
}

Methods

impl<T, U, Op> InsertStatement<T, U, Op>
[src]

fn returning<E>(self, returns: E) -> InsertQuery<E, Self> where E: Expression + SelectableExpression<T>, InsertQuery<E, Self>: Query

Specify what expression is returned after execution of the insert.

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> Clone for InsertStatement<T, U, Op>
[src]

fn clone(&self) -> InsertStatement<T, U, Op>

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> Copy for InsertStatement<T, U, Op>
[src]

impl<T: Debug, U: Debug, Op: Debug> Debug for InsertStatement<T, U, Op>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T, U, Op, DB> QueryFragment<DB> for InsertStatement<T, U, Op> where DB: Backend, T: Table, T::FromClause: QueryFragment<DB>, U: Insertable<T, DB> + Copy, Op: QueryFragment<DB>
[src]

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> QueryId for InsertStatement<T, U, Op>
[src]

impl<T, U, Op> AsQuery for InsertStatement<T, U, Op> where T: Table, InsertQuery<T::AllColumns, InsertStatement<T, U, Op>>: Query
[src]

type SqlType = Self::Query::SqlType

type Query = InsertQuery<T::AllColumns, Self>

fn as_query(self) -> Self::Query