pub struct TransactionManager { /* private fields */ }Expand description
Main transaction manager
Implementations§
Source§impl TransactionManager
impl TransactionManager
Sourcepub fn new(pool: PgPool, config: TransactionConfig) -> Self
pub fn new(pool: PgPool, config: TransactionConfig) -> Self
Create a new transaction manager
Sourcepub fn new_default(pool: PgPool) -> Self
pub fn new_default(pool: PgPool) -> Self
Create a new transaction manager with default configuration
Sourcepub async fn execute_with_retry<T, F, Fut>(
&self,
config: Option<TransactionConfig>,
f: F,
) -> Result<T>
pub async fn execute_with_retry<T, F, Fut>( &self, config: Option<TransactionConfig>, f: F, ) -> Result<T>
Execute a function within a transaction with retry logic
Sourcepub async fn execute_cached_query(
&self,
sql: &str,
_params: &[&(dyn Encode<'_, Postgres> + Send + Sync)],
) -> Result<PgQueryResult>
pub async fn execute_cached_query( &self, sql: &str, _params: &[&(dyn Encode<'_, Postgres> + Send + Sync)], ) -> Result<PgQueryResult>
Execute a query with statement caching
Sourcepub async fn stats(&self) -> TransactionManagerStats
pub async fn stats(&self) -> TransactionManagerStats
Get transaction manager statistics
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TransactionManager
impl !UnwindSafe for TransactionManager
impl Freeze for TransactionManager
impl Send for TransactionManager
impl Sync for TransactionManager
impl Unpin for TransactionManager
impl UnsafeUnpin for TransactionManager
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> ErasedDestructor for Twhere
T: 'static,
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