pub trait DatabasePool: Send + Sync {
// Required methods
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseConnection>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn fetch_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Vec<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn fetch_optional<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Option<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stats(&self) -> DatabasePoolStats;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Duration>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Abstract database connection pool trait
Required Methods§
Sourcefn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acquire<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Acquire a connection from the pool
Sourcefn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<Box<dyn DatabaseTransaction>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin a transaction from the pool
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<u64>> + 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 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a query directly on the pool
Sourcefn fetch_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Vec<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Vec<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a query and return result rows directly on the pool
Sourcefn fetch_optional<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Option<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fetch_optional<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [DatabaseValue],
) -> Pin<Box<dyn Future<Output = OrmResult<Option<Box<dyn DatabaseRow>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a query and return the first result row directly on the pool
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = OrmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the pool
Sourcefn stats(&self) -> DatabasePoolStats
fn stats(&self) -> DatabasePoolStats
Get pool statistics