Function diesel::query_builder::update [] [src]

pub fn update<T: UpdateTarget>(source: T) -> IncompleteUpdateStatement<T>

Creates an update statement. Helpers for updating a single row can be generated by #[changeset_for].

Example

Examples

Deleting a single record:

let command = update(users.filter(id.eq(1)))
    .set(name.eq("James"));
let updated_row = connection.query_one(command);
// When passed to `query_one`, the update statement will gain `RETURNING *`
assert_eq!(Ok((1, "James".to_string())), updated_row);