DatabaseBackend

Trait DatabaseBackend 

Source
pub trait DatabaseBackend: Send + Sync {
    // Required methods
    fn create_pool<'life0, 'life1, 'async_trait>(
        &'life0 self,
        database_url: &'life1 str,
        config: DatabasePoolConfig,
    ) -> Pin<Box<dyn Future<Output = OrmResult<Arc<dyn DatabasePool>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sql_dialect(&self) -> SqlDialect;
    fn backend_type(&self) -> DatabaseBackendType;
    fn validate_database_url(&self, url: &str) -> OrmResult<()>;
    fn parse_database_url(
        &self,
        url: &str,
    ) -> OrmResult<DatabaseConnectionConfig>;
}
Expand description

Database backend trait that provides database-specific implementations

Required Methods§

Source

fn create_pool<'life0, 'life1, 'async_trait>( &'life0 self, database_url: &'life1 str, config: DatabasePoolConfig, ) -> Pin<Box<dyn Future<Output = OrmResult<Arc<dyn DatabasePool>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a connection pool from a database URL

Source

fn sql_dialect(&self) -> SqlDialect

Get the SQL dialect used by this backend

Source

fn backend_type(&self) -> DatabaseBackendType

Get the backend type

Source

fn validate_database_url(&self, url: &str) -> OrmResult<()>

Validate a database URL for this backend

Source

fn parse_database_url(&self, url: &str) -> OrmResult<DatabaseConnectionConfig>

Parse connection parameters from a database URL

Implementors§