pub struct UpdateOne<A>(/* private fields */)
where
A: ActiveModelTrait;Expand description
A request to update an ActiveModel.
The primary key must be set.
Otherwise, it’s impossible to generate the SQL condition and find the record.
In that case, exec will return an error and not send any queries to the database.
If you want to use QueryTrait and access the generated SQL query,
you need to convert into ValidatedUpdateOne first.
Implementations§
Source§impl<A> UpdateOne<A>where
A: ActiveModelTrait,
impl<A> UpdateOne<A>where
A: ActiveModelTrait,
Sourcepub async fn exec<C>(
self,
db: &C,
) -> Result<<<A as ActiveModelTrait>::Entity as EntityTrait>::Model, DbErr>where
<<A as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<A>,
C: ConnectionTrait,
pub async fn exec<C>(
self,
db: &C,
) -> Result<<<A as ActiveModelTrait>::Entity as EntityTrait>::Model, DbErr>where
<<A as ActiveModelTrait>::Entity as EntityTrait>::Model: IntoActiveModel<A>,
C: ConnectionTrait,
Execute an UPDATE operation on an ActiveModel
Source§impl<A> UpdateOne<A>where
A: ActiveModelTrait,
impl<A> UpdateOne<A>where
A: ActiveModelTrait,
Sourcepub fn validate(self) -> Result<ValidatedUpdateOne<A>, DbErr>
pub fn validate(self) -> Result<ValidatedUpdateOne<A>, DbErr>
Check whether the primary key is set and we can proceed with the operation.
Trait Implementations§
Source§impl<A> TryFrom<UpdateOne<A>> for ValidatedUpdateOne<A>where
A: ActiveModelTrait,
impl<A> TryFrom<UpdateOne<A>> for ValidatedUpdateOne<A>where
A: ActiveModelTrait,
Auto Trait Implementations§
impl<A> !RefUnwindSafe for UpdateOne<A>
impl<A> !UnwindSafe for UpdateOne<A>
impl<A> Freeze for UpdateOne<A>where
A: Freeze,
impl<A> Send for UpdateOne<A>where
A: Send,
impl<A> Sync for UpdateOne<A>where
A: Sync,
impl<A> Unpin for UpdateOne<A>where
A: Unpin,
impl<A> UnsafeUnpin for UpdateOne<A>where
A: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more