[][src]Struct oration::db::Conn

pub struct Conn(pub PooledConnection<ConnectionManager<SqliteConnection>>);

Connection request guard type: a wrapper around an r2d2 pooled connection.

Methods from Deref<Target = SqliteConnection>

Run a transaction with BEGIN IMMEDIATE

This method will return an error if a transaction is already open.

Example

conn.immediate_transaction(|| {
    // Do stuff in a transaction
    Ok(())
})

Run a transaction with BEGIN EXCLUSIVE

This method will return an error if a transaction is already open.

Example

conn.exclusive_transaction(|| {
    // Do stuff in a transaction
    Ok(())
})

Trait Implementations

impl Deref for Conn
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<'a, 'r> FromRequest<'a, 'r> for Conn
[src]

Attempts to retrieve a single connection from the managed database pool. If no pool is currently managed, fails with an InternalServerError status. If no connections are available, fails with a ServiceUnavailable status.

The associated error to be returned if derivation fails.

Derives an instance of Self from the incoming request metadata. Read more

Auto Trait Implementations

impl Send for Conn

impl !Sync for Conn