Trait warpgrapher::engine::database::DatabasePool [−][src]
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
Loading content...Required methods
#[must_use]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,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::TransactionType, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
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 = Neo4jEndpoint::from_env()?; let pool = endpoint.pool().await?; let transaction = pool.transaction().await?;
#[must_use]fn client<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<DatabaseClient, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<DatabaseClient, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Returns a DatabaseClient
for the database for which this DatabasePool has connections
Errors
Returns an Error
if the client cannot be obtained from the pool. The specific Error
variant depends on the database back-end.
Examples
let endpoint = Neo4jEndpoint::from_env()?; let pool = endpoint.pool().await?; let client = pool.client().await?;
Implementors
impl DatabasePool for NoDatabasePool
[src]
type TransactionType = NoTransaction
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,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::TransactionType, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn client<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<DatabaseClient, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<DatabaseClient, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,