Trait warpgrapher::engine::database::DatabaseEndpoint[][src]

pub trait DatabaseEndpoint {
    type PoolType: DatabasePool;
#[must_use]    fn pool<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::PoolType, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

Trait for a database endpoint. Structs that implement this trait typically take in a connection string and produce a database pool of clients connected to the database

Associated Types

Loading content...

Required methods

#[must_use]fn pool<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::PoolType, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Returns a DatabasePool to the database for which this DatabaseEndpoint has connection information

Errors

Returns an Error if the database pool cannot be built, for example if the database connection information in the implementation of the DatabaseEndpoint does not successfully connect to a database. The specific Error variant depends on the database back-end.

Examples

let mut runtime = Runtime::new()?;
let endpoint = Neo4jEndpoint::from_env()?;
let pool = runtime.block_on(endpoint.pool())?;
Loading content...

Implementors

impl DatabaseEndpoint for NoDatabaseEndpoint[src]

type PoolType = NoDatabasePool

Loading content...