Enum diesel::connection::TransactionManagerStatus

source ·
pub enum TransactionManagerStatus {
    Valid(ValidTransactionManagerStatus),
    InError,
}
Expand description

Status of the transaction manager

Variants§

§

Valid(ValidTransactionManagerStatus)

Valid status, the manager can run operations

§

InError

Error status, probably following a broken connection. The manager will no longer run operations

Implementations§

source§

impl TransactionManagerStatus

source

pub fn transaction_depth(&self) -> QueryResult<Option<NonZeroU32>>

Returns the transaction depth if the transaction manager’s status is valid, or returns Error::BrokenTransactionManager if the transaction manager is in error.

source

pub fn set_requires_rollback_maybe_up_to_top_level(&mut self, to: bool)

Available on (crate features i-implement-a-third-party-backend-and-opt-into-breaking-changes or postgres or mysql) and crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

If in transaction and transaction manager is not broken, registers that it’s possible that the connection can not be used anymore until top-level transaction is rolled back.

If that is registered, savepoints rollbacks will still be attempted, but failure to do so will not result in an error. (Some may succeed, some may not.)

source

pub fn set_in_error(&mut self)

Sets the transaction manager status to InError

Subsequent attempts to use transaction-related features will result in a Error::BrokenTransactionManager error

source

pub fn transaction_state( &mut self ) -> QueryResult<&mut ValidTransactionManagerStatus>

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

Expose access to the inner transaction state

This function returns an error if the Transaction manager is in a broken state

source

pub fn set_test_transaction_flag(&mut self)

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.

This function allows to flag a transaction manager in such a way that it contains a test transaction.

This will disable some checks in regards to open transactions to allow Connection::begin_test_transaction to work with pooled connections as well

Trait Implementations§

source§

impl Debug for TransactionManagerStatus

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TransactionManagerStatus

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoSql for T

source§

fn into_sql<T>(self) -> AsExprOf<Self, T>

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T>

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V