BackendTrait

Trait BackendTrait 

Source
pub trait BackendTrait:
    Sized
    + Send
    + Sync
    + 'static {
    type ConnectionManager: ManageConnection;
    type ConnectionError: Debug;
    type QueryError: Debug;

    // Required methods
    fn init(&self) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
    fn create(
        &self,
        db_id: Uuid,
        restrict_privileges: bool,
    ) -> Result<Pool<Self::ConnectionManager>, Error<Self::ConnectionError, Self::QueryError>>;
    fn clean(
        &self,
        db_id: Uuid,
    ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
    fn drop(
        &self,
        db_id: Uuid,
        is_restricted: bool,
    ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>;
}
Expand description

Backend trait

Required Associated Types§

Source

type ConnectionManager: ManageConnection

Type that implements the r2d2::ManageConnection trait

Source

type ConnectionError: Debug

Connection error type that implements Debug

Source

type QueryError: Debug

Query error type that implements Debug

Required Methods§

Source

fn init(&self) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>

Initializes the backend

Source

fn create( &self, db_id: Uuid, restrict_privileges: bool, ) -> Result<Pool<Self::ConnectionManager>, Error<Self::ConnectionError, Self::QueryError>>

Creates a database

Source

fn clean( &self, db_id: Uuid, ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>

Cleans a database

Source

fn drop( &self, db_id: Uuid, is_restricted: bool, ) -> Result<(), Error<Self::ConnectionError, Self::QueryError>>

Drops a database

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.

Implementors§