Struct diesel::query_builder::insert_statement::InsertStatement
[−]
[src]
pub struct InsertStatement<T, U> { // some fields omitted }
Methods
impl<T, U> InsertStatement<T, U>
[src]
fn returning<E>(self, returns: E) -> InsertQuery<E, InsertStatement<T, U>> where E: Expression, InsertQuery<E, InsertStatement<T, U>>: 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);