pub struct DeleteOne<E: EntityTrait>(/* private fields */);Expand description
A request to delete 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 ValidatedDeleteOne first.
Implementationsยง
Sourceยงimpl<E> DeleteOne<E>where
E: EntityTrait,
impl<E> DeleteOne<E>where
E: EntityTrait,
Sourcepub fn exec<C>(self, db: &C) -> Result<DeleteResult, DbErr>where
C: ConnectionTrait,
pub fn exec<C>(self, db: &C) -> Result<DeleteResult, DbErr>where
C: ConnectionTrait,
Execute a DELETE operation on one ActiveModel
Sourcepub fn exec_with_returning<C>(self, db: &C) -> Result<Option<E::Model>, DbErr>where
C: ConnectionTrait,
pub fn exec_with_returning<C>(self, db: &C) -> Result<Option<E::Model>, DbErr>where
C: ConnectionTrait,
Execute an delete operation and return the deleted model
Sourceยงimpl<E: EntityTrait> DeleteOne<E>
impl<E: EntityTrait> DeleteOne<E>
Sourcepub fn validate(self) -> Result<ValidatedDeleteOne<E>, DbErr>
pub fn validate(self) -> Result<ValidatedDeleteOne<E>, DbErr>
Check whether the primary key is set and we can proceed with the operation.
Trait Implementationsยง
Auto Trait Implementationsยง
impl<E> Freeze for DeleteOne<E>
impl<E> !RefUnwindSafe for DeleteOne<E>
impl<E> Send for DeleteOne<E>where
E: Send,
impl<E> Sync for DeleteOne<E>where
E: Sync,
impl<E> Unpin for DeleteOne<E>where
E: Unpin,
impl<E> !UnwindSafe for DeleteOne<E>
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