[][src]Trait sqlx::prelude::Connection

pub trait Connection: Send + 'static + Executor {
    fn close(
        self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'static + Send>>;
fn ping(
        &mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>; fn begin(
        self
    ) -> Pin<Box<dyn Future<Output = Result<Transaction<Self>, Error>> + 'static + Send>> { ... } }

Represents a single database connection rather than a pool of database connections.

Prefer running queries from [Pool] unless there is a specific need for a single, continuous connection.

Required methods

fn close(
    self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'static + Send>>

Close this database connection.

fn ping(&mut self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>

Verifies a connection to the database is still alive.

Loading content...

Provided methods

fn begin(
    self
) -> Pin<Box<dyn Future<Output = Result<Transaction<Self>, Error>> + 'static + Send>>

Starts a transaction.

Returns Transaction.

Loading content...

Implementors

impl Connection for MySqlConnection[src]

impl Connection for PgConnection[src]

impl<C> Connection for PoolConnection<C> where
    C: Connect
[src]

fn close(
    self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'static + Send>>
[src]

Detach the connection from the pool and close it nicely.

Loading content...