Skip to main content

ModelUpdate

Struct ModelUpdate 

Source
pub struct ModelUpdate<M: Table> { /* private fields */ }
Expand description

A pending model UPDATE: the statement (which filters and mods have already landed on) plus the setter, joined together only at verb time so Table::before_update sees the setter first.

Implementations§

Source§

impl<M: Table> ModelUpdate<M>

Source

pub fn apply(&mut self, mods: impl Mod<M::Update>)

Apply mods written against the concrete dialect statement — the same escape hatch as ModelSelect::apply.

Source

pub async fn exec(self, db: &dyn Executor) -> Result<ExecResult, ExecError>

Update for the side effect; answers how many rows changed.

Source

pub async fn all(self, db: &dyn Executor) -> Result<Vec<M::Row>, ExecError>

Update and decode whatever the statement’s RETURNING produced — which is nothing unless a returning mod (or the generated model) put one on. The rows come back as this model’s row struct.

Trait Implementations§

Source§

impl<M: Table> Debug for ModelUpdate<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: Table> HasJoins for ModelUpdate<M>
where M::Update: HasJoins,

Source§

fn joins_mut(&mut self) -> &mut Vec<Join>

The join list to modify.
Source§

impl<M: Table> HasLimit for ModelUpdate<M>
where M::Update: HasLimit,

Source§

fn limit_mut(&mut self) -> &mut Limit

The LIMIT clause to modify.
Source§

impl<M: Table> HasOrderBy for ModelUpdate<M>
where M::Update: HasOrderBy,

Source§

fn order_by_mut(&mut self) -> &mut OrderBy

The ORDER BY clause to modify.
Source§

impl<M: Table> HasReturning for ModelUpdate<M>
where M::Update: HasReturning,

Source§

fn returning_mut(&mut self) -> &mut Returning

The RETURNING clause to modify.
Source§

impl<M: Table> HasSet for ModelUpdate<M>
where M::Update: HasSet,

Source§

fn set_mut(&mut self) -> &mut Set

The assignment list to modify.
Source§

impl<M: Table> HasTableRef for ModelUpdate<M>
where M::Update: HasTableRef,

Source§

fn table_ref_mut(&mut self) -> &mut TableRef

The table reference to modify.
Source§

impl<M: Table> HasWhere for ModelUpdate<M>
where M::Update: HasWhere,

Source§

fn where_mut(&mut self) -> &mut Where

The WHERE clause to modify.
Source§

impl<M: Table> HasWith for ModelUpdate<M>
where M::Update: HasWith,

Source§

fn with_mut(&mut self) -> &mut With

The WITH clause to modify.

Auto Trait Implementations§

§

impl<M> Freeze for ModelUpdate<M>
where <M as Table>::Setter: Freeze, <M as Table>::Update: Freeze,

§

impl<M> RefUnwindSafe for ModelUpdate<M>

§

impl<M> Send for ModelUpdate<M>

§

impl<M> Sync for ModelUpdate<M>
where <M as Table>::Setter: Sync,

§

impl<M> Unpin for ModelUpdate<M>
where <M as Table>::Setter: Unpin, <M as Table>::Update: Unpin,

§

impl<M> UnsafeUnpin for ModelUpdate<M>
where <M as Table>::Setter: UnsafeUnpin, <M as Table>::Update: UnsafeUnpin,

§

impl<M> UnwindSafe for ModelUpdate<M>
where <M as Table>::Setter: UnwindSafe, <M as Table>::Update: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.