Skip to main content

GenericClient

Trait GenericClient 

Source
pub trait GenericClient: Sync {
    // Required methods
    fn prepare(
        &self,
        query: &str,
    ) -> impl Future<Output = Result<Statement, Error>> + Send;
    fn query<T>(
        &self,
        statement: &T,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = Result<Vec<Row>, Error>> + Send
       where T: ?Sized + Query;
    fn query_one<T>(
        &self,
        statement: &T,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = Result<Row, Error>> + Send
       where T: ?Sized + Query;
    fn query_opt<T>(
        &self,
        statement: &T,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = Result<Option<Row>, Error>> + Send
       where T: ?Sized + Query;
    fn execute<T>(
        &self,
        statement: &T,
        params: &[&(dyn ToSql + Sync)],
    ) -> impl Future<Output = Result<u64, Error>> + Send
       where T: ?Sized + Query;
    fn batch_execute(
        &self,
        query: &str,
    ) -> impl Future<Output = Result<(), Error>> + Send;
}
Expand description

The instrumented calls of a Client or a Transaction, for helpers that take either. tokio-postgres’s own GenericClient is sealed.

Required Methods§

Source

fn prepare( &self, query: &str, ) -> impl Future<Output = Result<Statement, Error>> + Send

Source

fn query<T>( &self, statement: &T, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = Result<Vec<Row>, Error>> + Send
where T: ?Sized + Query,

Source

fn query_one<T>( &self, statement: &T, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = Result<Row, Error>> + Send
where T: ?Sized + Query,

Source

fn query_opt<T>( &self, statement: &T, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = Result<Option<Row>, Error>> + Send
where T: ?Sized + Query,

Source

fn execute<T>( &self, statement: &T, params: &[&(dyn ToSql + Sync)], ) -> impl Future<Output = Result<u64, Error>> + Send
where T: ?Sized + Query,

Source

fn batch_execute( &self, query: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§