Skip to main content

RawConnection

Trait RawConnection 

Source
pub trait RawConnection: Send + Debug {
    // Required methods
    fn family(&self) -> Family;
    fn fetch<'a>(
        &'a mut self,
        sql: &'a str,
        args: Vec<Value>,
    ) -> ExecFuture<'a, Result<Vec<Row>, ExecError>>;
    fn execute<'a>(
        &'a mut self,
        sql: &'a str,
        args: Vec<Value>,
    ) -> ExecFuture<'a, Result<ExecResult, ExecError>>;
    fn abandon(self: Box<Self>);
}
Expand description

One raw connection, exclusively held. The seam a backend implements.

keelson-sqlx implements this once per driver; a future backend implements it once. Everything else — Transaction, the transaction SQL, the verb layer — is written once in this crate against it, which is what keeps transaction semantics identical across backends.

Required Methods§

Source

fn family(&self) -> Family

Which engine family this connection talks to.

Source

fn fetch<'a>( &'a mut self, sql: &'a str, args: Vec<Value>, ) -> ExecFuture<'a, Result<Vec<Row>, ExecError>>

Run a statement and collect every row.

Source

fn execute<'a>( &'a mut self, sql: &'a str, args: Vec<Value>, ) -> ExecFuture<'a, Result<ExecResult, ExecError>>

Run a statement for its side effect.

Source

fn abandon(self: Box<Self>)

Dispose of a connection whose server-side state is unknown — an abandoned transaction. Must not return the connection to a pool as reusable: close it (the server then discards the open transaction).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§