pub struct Transaction<'p, DB, Repos = ()> { /* private fields */ }Expand description
Transaction builder for composing repositories.
Use Transaction::new to create a builder, then chain .with_*() methods
to add repositories, and finally call .run() to execute.
§Type Parameters
DB— Database type (e.g.,Postgres)Repos— Tuple of repository adapters accumulated via builder
Implementations§
Source§impl<'p, DB> Transaction<'p, DB>
impl<'p, DB> Transaction<'p, DB>
Source§impl<'p, DB, Repos> Transaction<'p, DB, Repos>
impl<'p, DB, Repos> Transaction<'p, DB, Repos>
Source§impl<'p, Repos> Transaction<'p, Pool<Postgres>, Repos>where
Repos: Send,
impl<'p, Repos> Transaction<'p, Pool<Postgres>, Repos>where
Repos: Send,
Sourcepub async fn run<F, Fut, T, E>(self, f: F) -> Result<T, E>where
F: for<'t> FnOnce(TransactionContext<'t, Transaction<'t, Postgres>, Repos>) -> Fut + Send,
Fut: Future<Output = Result<T, E>> + Send,
E: From<TransactionError<Error>>,
Repos: Default,
pub async fn run<F, Fut, T, E>(self, f: F) -> Result<T, E>where
F: for<'t> FnOnce(TransactionContext<'t, Transaction<'t, Postgres>, Repos>) -> Fut + Send,
Fut: Future<Output = Result<T, E>> + Send,
E: From<TransactionError<Error>>,
Repos: Default,
Auto Trait Implementations§
impl<'p, DB, Repos> Freeze for Transaction<'p, DB, Repos>
impl<'p, DB, Repos> RefUnwindSafe for Transaction<'p, DB, Repos>where
DB: RefUnwindSafe,
Repos: RefUnwindSafe,
impl<'p, DB, Repos> Send for Transaction<'p, DB, Repos>
impl<'p, DB, Repos> Sync for Transaction<'p, DB, Repos>
impl<'p, DB, Repos> Unpin for Transaction<'p, DB, Repos>where
Repos: Unpin,
impl<'p, DB, Repos> UnwindSafe for Transaction<'p, DB, Repos>where
DB: RefUnwindSafe,
Repos: UnwindSafe,
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> 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