pub struct UpdateQuery {
pub with: With,
pub table: TableRef,
pub set: Set,
pub from: TableRef,
pub extra_from: Vec<TableRef>,
pub where_: Where,
pub returning: Returning,
}Expand description
A PostgreSQL UPDATE.
From https://www.postgresql.org/docs/17/sql-update.html:
[ WITH [ RECURSIVE ] with_query [, ...] ]
UPDATE [ ONLY ] table_name [ * ] [ [ AS ] alias ]
SET { column_name = { expression | DEFAULT }
| ( column_name [, ...] ) = [ ROW ] ( { expression | DEFAULT } [, ...] )
| ( column_name [, ...] ) = ( sub-SELECT ) } [, ...]
[ FROM from_item [, ...] ]
[ WHERE condition | WHERE CURRENT OF cursor_name ]
[ RETURNING … ]ONLY lives on TableRef::only, because that is where the shared clause puts
it and because the same flag decorates a FROM item.
The assignment list is not optional: UPDATE t with no SET is not a statement,
so an empty Set is a recorded Error::Incomplete rather than a clause that
renders nothing.
Fields§
§with: WithWITH ….
table: TableRefThe table being updated.
set: SetSET ….
from: TableRefThe first FROM item, with its joins.
extra_from: Vec<TableRef>Further comma-separated FROM items.
where_: WhereWHERE ….
returning: ReturningRETURNING ….
Implementations§
Source§impl UpdateQuery
impl UpdateQuery
Sourcepub fn new() -> UpdateQuery
pub fn new() -> UpdateQuery
An UPDATE with nothing set yet.
Sourcepub fn apply(&mut self, mods: impl Mod<UpdateQuery>)
pub fn apply(&mut self, mods: impl Mod<UpdateQuery>)
Apply more mods to an existing query.
Trait Implementations§
Source§impl Clone for UpdateQuery
impl Clone for UpdateQuery
Source§fn clone(&self) -> UpdateQuery
fn clone(&self) -> UpdateQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UpdateQuery
impl Debug for UpdateQuery
Source§impl Default for UpdateQuery
impl Default for UpdateQuery
Source§fn default() -> UpdateQuery
fn default() -> UpdateQuery
Returns the “default value” for a type. Read more
Source§impl Expression for UpdateQuery
impl Expression for UpdateQuery
Source§impl HasExtraTables for UpdateQuery
impl HasExtraTables for UpdateQuery
Source§fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
The additional from-items to modify.
Source§impl HasJoins for UpdateQuery
impl HasJoins for UpdateQuery
Source§impl HasReturning for UpdateQuery
impl HasReturning for UpdateQuery
Source§fn returning_mut(&mut self) -> &mut Returning
fn returning_mut(&mut self) -> &mut Returning
The
RETURNING clause to modify.Source§impl HasSet for UpdateQuery
impl HasSet for UpdateQuery
Source§impl HasTableRef for UpdateQuery
impl HasTableRef for UpdateQuery
Source§fn table_ref_mut(&mut self) -> &mut TableRef
fn table_ref_mut(&mut self) -> &mut TableRef
The table reference to modify.
Source§impl HasTargetTable for UpdateQuery
impl HasTargetTable for UpdateQuery
Source§fn target_table_mut(&mut self) -> &mut TableRef
fn target_table_mut(&mut self) -> &mut TableRef
The target table to modify.
Source§impl HasWhere for UpdateQuery
impl HasWhere for UpdateQuery
Source§impl HasWith for UpdateQuery
impl HasWith for UpdateQuery
Source§impl IntoExprList for UpdateQuery
impl IntoExprList for UpdateQuery
Source§fn into_expr_list(self) -> Vec<Expr>
fn into_expr_list(self) -> Vec<Expr>
Perform the conversion.
Source§impl Query for UpdateQuery
impl Query for UpdateQuery
Source§impl<H, L, M> QueryExtensions<H, L, M> for UpdateQuery
impl<H, L, M> QueryExtensions<H, L, M> for UpdateQuery
Auto Trait Implementations§
impl !RefUnwindSafe for UpdateQuery
impl !UnwindSafe for UpdateQuery
impl Freeze for UpdateQuery
impl Send for UpdateQuery
impl Sync for UpdateQuery
impl Unpin for UpdateQuery
impl UnsafeUnpin for UpdateQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more