Skip to main content

Datasource

Trait Datasource 

Source
pub trait Datasource: Send + Sync {
    // Required methods
    fn provider(&self) -> &str;
    fn create_connection<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Connection>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_command<'life0, 'async_trait>(
        &'life0 self,
        connection: Option<Arc<dyn Connection>>,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Command>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn bind_connection(
        &self,
        connection: Option<Arc<dyn Connection>>,
    ) -> Arc<dyn Connection> ⓘ;
    fn row_type_converters(
        &self,
    ) -> HashMap<String, Box<dyn TypeConverter<Value, Value> + Send + Sync>>;
    fn repository_from(
        &self,
        connection: Arc<dyn Connection>,
        options: CRUDRepositoryOptions,
    ) -> Arc<dyn ICRUDRepository<Row>> ⓘ;
    fn readonly_repository_from(
        &self,
        connection: Arc<dyn Connection>,
        options: ReadonlyRepositoryMappingOptions,
    ) -> Arc<dyn IReadonlyRepository<Row>> ⓘ;
    fn repositories(&self) -> &RepositoryFactory;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn row_converter(&self, schema: &Schema) -> RowTypeConverter { ... }
}

Required Methods§

Source

fn provider(&self) -> &str

Source

fn create_connection<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Connection>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn create_command<'life0, 'async_trait>( &'life0 self, connection: Option<Arc<dyn Connection>>, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn Command>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn bind_connection( &self, connection: Option<Arc<dyn Connection>>, ) -> Arc<dyn Connection> ⓘ

Source

fn row_type_converters( &self, ) -> HashMap<String, Box<dyn TypeConverter<Value, Value> + Send + Sync>>

Source

fn repository_from( &self, connection: Arc<dyn Connection>, options: CRUDRepositoryOptions, ) -> Arc<dyn ICRUDRepository<Row>> ⓘ

Source

fn readonly_repository_from( &self, connection: Arc<dyn Connection>, options: ReadonlyRepositoryMappingOptions, ) -> Arc<dyn IReadonlyRepository<Row>> ⓘ

Source

fn repositories(&self) -> &RepositoryFactory

Source

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

Provided Methods§

Implementations§

Source§

impl dyn Datasource

Source

pub fn create_repository<T: 'static>( &self, connection: Option<Arc<dyn Connection>>, options: Option<CRUDRepositoryOptions>, ) -> Arc<dyn ICRUDRepository<Row>> ⓘ

Source

pub fn create_typed_repository<T: FromSchema + 'static>( &self, connection: Option<Arc<dyn Connection>>, options: Option<CRUDRepositoryOptions>, ) -> Arc<dyn ICRUDRepository<T>> ⓘ

Source

pub fn create_readonly_repository<T: 'static>( &self, connection: Option<Arc<dyn Connection>>, options: Option<ReadonlyRepositoryMappingOptions>, ) -> Arc<dyn IReadonlyRepository<Row>> ⓘ

Source

pub fn create_repository_by_name<T: FromSchema>( &self, name: &str, connection: Option<Arc<dyn Connection>>, ) -> Result<Arc<dyn ICRUDRepository<T>>>

Source

pub fn create_readonly_repository_by_name<T: FromSchema>( &self, name: &str, connection: Option<Arc<dyn Connection>>, ) -> Result<Arc<dyn IReadonlyRepository<T>>>

Source

pub fn access( &self, name: &str, connection: Option<Arc<dyn Connection>>, ) -> RepositoryAccess

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§