Function diesel::update
[−]
[src]
pub fn update<T: IntoUpdateTarget>(source: T)
-> IncompleteUpdateStatement<T::Table, T::WhereClause>
Creates an update statement. Helpers for updating a single row can be
generated by deriving AsChangeset
Examples
Updating a single record:
let updated_row = diesel::update(users.filter(id.eq(1))) .set(name.eq("James")) .get_result(&connection); // On backends that support it, you can call `get_result` instead of `execute` // to have `RETURNING *` automatically appended to the query. Alternatively, you // can explicitly return an expression by using the `returning` method before // getting the result. assert_eq!(Ok((1, "James".to_string())), updated_row);