ProxyDatabaseTrait

Trait ProxyDatabaseTrait 

Source
pub trait ProxyDatabaseTrait: Debug {
    // Required methods
    fn query(&self, statement: Statement) -> Result<Vec<ProxyRow>, DbErr>;
    fn execute(&self, statement: Statement) -> Result<ProxyExecResult, DbErr>;

    // Provided methods
    fn begin(&self) { ... }
    fn commit(&self) { ... }
    fn rollback(&self) { ... }
    fn start_rollback(&self) { ... }
    fn ping(&self) -> Result<(), DbErr> { ... }
}
Available on crate feature proxy only.
Expand description

Defines the ProxyDatabaseTrait to save the functions

Required Methods§

Source

fn query(&self, statement: Statement) -> Result<Vec<ProxyRow>, DbErr>

Execute a query in the [ProxyDatabase], and return the query results

Source

fn execute(&self, statement: Statement) -> Result<ProxyExecResult, DbErr>

Execute a command in the [ProxyDatabase], and report the number of rows affected

Provided Methods§

Source

fn begin(&self)

Begin a transaction in the [ProxyDatabase]

Source

fn commit(&self)

Commit a transaction in the [ProxyDatabase]

Source

fn rollback(&self)

Rollback a transaction in the [ProxyDatabase]

Source

fn start_rollback(&self)

Start rollback a transaction in the [ProxyDatabase]

Source

fn ping(&self) -> Result<(), DbErr>

Ping the [ProxyDatabase], it should return an error if the database is not available

Implementors§