Trait AsyncDbConnection

Source
pub trait AsyncDbConnection<T, P>: DbConnection<T, P> + Sync {
    // Required methods
    fn new(conn: T) -> Self
       where Self: Sized;
    fn tables<'life0, 'life1, 'async_trait>(
        &'life0 self,
        schema: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn schemas<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        table_reference: &'life1 TableReference,
    ) -> Pin<Box<dyn Future<Output = Result<SchemaRef, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query_arrow<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: &'life2 [P],
        projected_schema: Option<SchemaRef>,
    ) -> Pin<Box<dyn Future<Output = Result<SendableRecordBatchStream, GenericError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: &'life2 [P],
    ) -> Pin<Box<dyn Future<Output = Result<u64, GenericError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}

Required Methods§

Source

fn new(conn: T) -> Self
where Self: Sized,

Source

fn tables<'life0, 'life1, 'async_trait>( &'life0 self, schema: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn schemas<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_schema<'life0, 'life1, 'async_trait>( &'life0 self, table_reference: &'life1 TableReference, ) -> Pin<Box<dyn Future<Output = Result<SchemaRef, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the schema for a table reference.

§Arguments
  • table_reference - The table reference.
Source

fn query_arrow<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [P], projected_schema: Option<SchemaRef>, ) -> Pin<Box<dyn Future<Output = Result<SendableRecordBatchStream, GenericError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Query the database with the given SQL statement and parameters, returning a Result of SendableRecordBatchStream.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.
  • projected_schema - The Projected schema for the query.
§Errors

Returns an error if the query fails.

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [P], ) -> Pin<Box<dyn Future<Output = Result<u64, GenericError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the given SQL statement with parameters, returning the number of affected rows.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.

Implementations on Foreign Types§

Source§

impl AsyncDbConnection<Client, ()> for Client

Available on crate feature clickhouse only.
Source§

fn get_schema<'life0, 'life1, 'async_trait>( &'life0 self, table_reference: &'life1 TableReference, ) -> Pin<Box<dyn Future<Output = Result<SchemaRef, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the schema for a table reference.

§Arguments
  • table_reference - The table reference.
Source§

fn query_arrow<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sql: &'life1 str, _params: &'life2 [()], projected_schema: Option<SchemaRef>, ) -> Pin<Box<dyn Future<Output = Result<SendableRecordBatchStream, GenericError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Query the database with the given SQL statement and parameters, returning a Result of SendableRecordBatchStream.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.
  • projected_schema - The Projected schema for the query.
§Errors

Returns an error if the query fails.

Source§

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [()], ) -> Pin<Box<dyn Future<Output = Result<u64, GenericError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute the given SQL statement with parameters, returning the number of affected rows.

§Arguments
  • sql - The SQL statement.
  • params - The parameters for the SQL statement.
Source§

fn new(conn: Client) -> Self
where Self: Sized,

Source§

fn tables<'life0, 'life1, 'async_trait>( &'life0 self, schema: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn schemas<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

Source§

impl AsyncDbConnection<Connection, &'static (dyn ToSql + Sync)> for SqliteConnection

Available on crate feature sqlite only.
Source§

impl<'a> AsyncDbConnection<PooledConnection<'static, PostgresConnectionManager<MakeTlsConnector>>, &'a (dyn ToSql + Sync)> for PostgresConnection

Available on crate feature postgres only.
Source§

impl<'a> AsyncDbConnection<Conn, &'a (dyn ToValue + Sync)> for MySQLConnection

Available on crate feature mysql only.
Source§

impl<'a> AsyncDbConnection<Connection<'a>, Box<dyn ODBCSyncParameter>> for ODBCConnection<'a>
where 'a: 'static,

Available on crate feature odbc only.