pub struct OpenTransaction(/* private fields */);
Expand description
Represents an already opened transaction. This is a thin wrapper over DatabaseTransaction. The wrapping behavior is needed to allow transaction agnostic functionalities of the DB traits.
Implementations§
Source§impl OpenTransaction
impl OpenTransaction
Sourcepub async fn perform<F, T, E>(self, callback: F) -> Result<T, E>where
F: for<'c> FnOnce(&'c OpenTransaction) -> BoxFuture<'c, Result<T, E>> + Send,
T: Send,
E: Error + From<DbSqlError>,
pub async fn perform<F, T, E>(self, callback: F) -> Result<T, E>where
F: for<'c> FnOnce(&'c OpenTransaction) -> BoxFuture<'c, Result<T, E>> + Send,
T: Send,
E: Error + From<DbSqlError>,
Executes the given callback
inside the transaction
and commits the transaction if it succeeds or rollbacks otherwise.
Trait Implementations§
Source§impl AsRef<DatabaseTransaction> for OpenTransaction
impl AsRef<DatabaseTransaction> for OpenTransaction
Source§fn as_ref(&self) -> &DatabaseTransaction
fn as_ref(&self) -> &DatabaseTransaction
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Debug for OpenTransaction
impl Debug for OpenTransaction
Source§impl From<OpenTransaction> for DatabaseTransaction
impl From<OpenTransaction> for DatabaseTransaction
Source§fn from(value: OpenTransaction) -> Self
fn from(value: OpenTransaction) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for OpenTransaction
impl !RefUnwindSafe for OpenTransaction
impl Send for OpenTransaction
impl Sync for OpenTransaction
impl Unpin for OpenTransaction
impl !UnwindSafe for OpenTransaction
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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