Skip to main content

DatabaseAdapter

Trait DatabaseAdapter 

Source
pub trait DatabaseAdapter<T: Send + Sync + Serialize + DeserializeOwned + 'static>: Send + Sync {
    // Required methods
    fn insert<'life0, 'async_trait>(
        &'life0 self,
        data: T,
    ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn insert_many<'life0, 'async_trait>(
        &'life0 self,
        data: Vec<T>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn upsert<'life0, 'async_trait>(
        &'life0 self,
        data: T,
    ) -> Pin<Box<dyn Future<Output = Result<String, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn upsert_many<'life0, 'async_trait>(
        &'life0 self,
        data: Vec<T>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_one<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_all<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_one_and_update<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
        update: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>, CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_many<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
        update: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_one<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_many<'life0, 'async_trait>(
        &'life0 self,
        filter: QueryBuilder,
    ) -> Pin<Box<dyn Future<Output = Result<(), CoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

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

Source

fn insert_many<'life0, 'async_trait>( &'life0 self, data: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn upsert_many<'life0, 'async_trait>( &'life0 self, data: Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_one<'life0, 'async_trait>( &'life0 self, filter: QueryBuilder, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_all<'life0, 'async_trait>( &'life0 self, filter: QueryBuilder, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_one_and_update<'life0, 'async_trait>( &'life0 self, filter: QueryBuilder, update: QueryBuilder, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, CoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

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

Source

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> DatabaseAdapter<T> for MongodbAdapter<T>
where T: Debug + Send + Sync + Serialize + DeserializeOwned + 'static + MongoInsert + IntoBsonDocument,

Source§

impl<T> DatabaseAdapter<T> for PostgreSQLAdapter<T>
where T: Send + Sync + Serialize + DeserializeOwned + 'static + for<'r> FromRow<'r, PgRow> + Unpin + PgInsert,

Source§

impl<T> DatabaseAdapter<T> for SQLiteAdapter<T>
where T: Send + Sync + Serialize + DeserializeOwned + 'static + for<'r> FromRow<'r, SqliteRow> + Unpin + SqliteInsert,