Skip to main content

DatabaseClient

Trait DatabaseClient 

Source
pub trait DatabaseClient: Send + Sync {
    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        query: DatabaseQuery,
    ) -> Pin<Box<dyn Future<Output = AppResult<DatabaseResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn begin<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = AppResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn ping<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Vendor-neutral database client.

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, query: DatabaseQuery, ) -> Pin<Box<dyn Future<Output = AppResult<DatabaseResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute a statement.

Source

fn begin<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = AppResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin a transaction.

Source

fn ping<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validate that the backend is usable.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§