Skip to main content

IDatabaseProvider

Trait IDatabaseProvider 

Source
pub trait IDatabaseProvider: Send + Sync {
    // Required methods
    fn sql_generator(&self) -> &'static dyn ISqlGenerator;
    fn get_connection<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = EFResult<Box<dyn IAsyncConnection>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn execute_migration_command<'life0, 'life1, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &str;
    fn migration_dialect(&self) -> MigrationDialect;
}
Expand description

The database provider abstraction. Corresponds to EFCore’s provider model.

Required Methods§

Source

fn sql_generator(&self) -> &'static dyn ISqlGenerator

Returns the SQL dialect generator for this provider.

Implementations are stateless, so a &'static reference is returned — no heap allocation per call.

Source

fn get_connection<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = EFResult<Box<dyn IAsyncConnection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets an async database connection from the pool.

Source

fn execute_migration_command<'life0, 'life1, 'async_trait>( &'life0 self, sql: &'life1 str, ) -> Pin<Box<dyn Future<Output = EFResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes a migration command (DDL).

Source

fn name(&self) -> &str

Returns the provider name (e.g., “PostgreSQL”, “MySQL”).

Source

fn migration_dialect(&self) -> MigrationDialect

Returns the migration dialect for this provider.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§