pub trait DatabasePool: Clone + Sync + Send {
    type TransactionType: Transaction;
    fn read_transaction<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::TransactionType, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn transaction<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::TransactionType, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }
Expand description

Trait for a database pool. Structs that implement this trait are created by a database endpoint and provide a way to get a transaction from the pool.

Associated Types

Required methods

Returns a Transaction for the database for which this DatabasePool has connections. If the database types offers specific read replicas, such as AWS Neptune, the connection is to a read replica. If no separate read replicas are offered, the connection is to the same endpoint that serves read/write requests.

Errors

Returns an Error if the transaction cannot be created. The specific Error variant depends on the database back-end.

Examples
let endpoint = CypherEndpoint::from_env()?;
let pool = endpoint.pool().await?;
let transaction = pool.read_transaction().await?;

Returns a Transaction for the database for which this DatabasePool has connections

Errors

Returns an Error if the transaction cannot be created. The specific Error variant depends on the database back-end.

Examples
let endpoint = CypherEndpoint::from_env()?;
let pool = endpoint.pool().await?;
let transaction = pool.transaction().await?;

Implementors