pub trait DatabaseBackend:
Send
+ Sync
+ Clone {
type Connection: Connection;
type Pool: DatabasePool<Connection = Self::Connection>;
// Required methods
fn create_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn drop_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_pool<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
config: &'life2 PoolConfig,
) -> Pin<Box<dyn Future<Output = Result<Self::Pool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn terminate_connections<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_database_from_template<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
template: &'life2 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
A trait for database backends that can create and manage databases
Required Associated Types§
Sourcetype Connection: Connection
type Connection: Connection
The type of connection this backend provides
Sourcetype Pool: DatabasePool<Connection = Self::Connection>
type Pool: DatabasePool<Connection = Self::Connection>
The type of pool this backend provides
Required Methods§
Sourcefn create_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a new database with the given name
Sourcefn drop_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn drop_database<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop a database with the given name
Sourcefn create_pool<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
config: &'life2 PoolConfig,
) -> Pin<Box<dyn Future<Output = Result<Self::Pool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_pool<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
config: &'life2 PoolConfig,
) -> Pin<Box<dyn Future<Output = Result<Self::Pool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new connection pool for the given database
Sourcefn terminate_connections<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn terminate_connections<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Terminate all connections to the given database
Sourcefn create_database_from_template<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
template: &'life2 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_database_from_template<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
name: &'life1 DatabaseName,
template: &'life2 DatabaseName,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new database from a template
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.