[−][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>
pub fn immediate_transaction<T, E, F>(&self, f: F) -> Result<T, E> where
E: From<Error>,
F: FnOnce() -> Result<T, E>,
pub fn immediate_transaction<T, E, F>(&self, f: F) -> Result<T, E> where
E: From<Error>,
F: FnOnce() -> Result<T, E>,
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(()) })
pub fn exclusive_transaction<T, E, F>(&self, f: F) -> Result<T, E> where
E: From<Error>,
F: FnOnce() -> Result<T, E>,
pub fn exclusive_transaction<T, E, F>(&self, f: F) -> Result<T, E> where
E: From<Error>,
F: FnOnce() -> Result<T, E>,
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(()) })
pub fn register_sql_function<ArgsSqlType, RetSqlType, Args, Ret, F>(
&self,
fn_name: &str,
deterministic: bool,
f: F
) -> Result<(), Error> where
Args: Queryable<ArgsSqlType, Sqlite>,
F: FnMut(Args) -> Ret + Send + 'static,
Ret: ToSql<RetSqlType, Sqlite>,
Sqlite: HasSqlType<RetSqlType>,
pub fn register_sql_function<ArgsSqlType, RetSqlType, Args, Ret, F>(
&self,
fn_name: &str,
deterministic: bool,
f: F
) -> Result<(), Error> where
Args: Queryable<ArgsSqlType, Sqlite>,
F: FnMut(Args) -> Ret + Send + 'static,
Ret: ToSql<RetSqlType, Sqlite>,
Sqlite: HasSqlType<RetSqlType>,
Trait Implementations
impl Deref for Conn
[src]
impl Deref for Conn
type Target = SqliteConnection
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<'a, 'r> FromRequest<'a, 'r> for Conn
[src]
impl<'a, 'r> FromRequest<'a, 'r> for Conn
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.