[][src]Struct diesel_transaction_handles::TransactionalConnection

pub struct TransactionalConnection<T: Connection>(_, _);

Methods

impl<C: Connection> TransactionalConnection<C>[src]

pub fn new(conn: C) -> Result<TransactionalConnection<C>, Error>[src]

pub fn rollback(self) -> Result<(), ErrorVec>[src]

pub fn commit(self) -> Result<(), Error>[src]

pub fn handle_result<T, E>(self, res: Result<T, E>) -> Result<T, Error> where
    Error: From<E>, 
[src]

pub fn add_rollback_hook(&self, hook: fn() -> Result<(), Error>)[src]

Trait Implementations

impl<C: Connection> Drop for TransactionalConnection<C>[src]

impl<C: Connection> Connection for TransactionalConnection<C>[src]

type Backend = C::Backend

The backend this type connects to

type TransactionManager = Self

fn transaction<T, E, F>(&self, f: F) -> Result<T, E> where
    E: From<Error>,
    F: FnOnce() -> Result<T, E>, 
[src]

Executes the given function inside of a database transaction Read more

fn begin_test_transaction(&self) -> Result<(), Error>[src]

Creates a transaction that will never be committed. This is useful for tests. Panics if called while inside of a transaction. Read more

fn test_transaction<T, E, F>(&self, f: F) -> T where
    E: Debug,
    F: FnOnce() -> Result<T, E>, 
[src]

Executes the given function inside a transaction, but does not commit it. Panics if the given function returns an error. Read more

impl<C: Connection> TransactionManager<TransactionalConnection<C>> for TransactionalConnection<C>[src]

impl<C: Connection> SimpleConnection for TransactionalConnection<C>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

Convert self to an expression for Diesel's query builder. Read more

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel's query builder. Read more