Skip to main content

Client

Trait Client 

Source
pub trait Client: QueryExecutor {
    type Transaction<'a>: Transaction<Error = Self::Error, Row = Self::Row> + 'a
       where Self: 'a;

    // Required method
    fn transaction(
        &mut self,
    ) -> impl Future<Output = Result<Self::Transaction<'_>, Self::Error>> + Send;
}
Expand description

Trait for executing SQL queries against a database connection. Extends QueryExecutor with transaction management.

This trait is backend-agnostic: implementations exist for PostgreSQL (tokio-postgres), and can be added for MySQL, SQLite, etc.

Required Associated Types§

Source

type Transaction<'a>: Transaction<Error = Self::Error, Row = Self::Row> + 'a where Self: 'a

Required Methods§

Source

fn transaction( &mut self, ) -> impl Future<Output = Result<Self::Transaction<'_>, Self::Error>> + Send

Begin a new transaction.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§