[][src]Trait meshuganah::RepositoryTrait

pub trait RepositoryTrait<T: Model> {
#[must_use]    fn new<'async_trait>(
        database: Database
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
    where
        Self: 'async_trait
;
fn get_collection(&self) -> Collection;
#[must_use] fn add_item<'life0, 'async_trait>(
        &'life0 self,
        filter: Option<Document>,
        item: T
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn add_many<'life0, 'async_trait, I: IntoIterator<Item = T> + Send, O: Into<Option<InsertManyOptions>> + Send>(
        &'life0 self,
        collection: I,
        options: O
    ) -> Pin<Box<dyn Future<Output = Result<InsertManyResult>> + Send + 'async_trait>>
    where
        I: 'async_trait,
        O: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn find_one<'life0, 'async_trait, F: Into<Option<Document>> + Send, O: Into<Option<FindOneOptions>> + Send>(
        &'life0 self,
        filter: F,
        options: O
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
    where
        F: 'async_trait,
        O: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn find<'life0, 'async_trait, F: Into<Option<Document>> + Send, O: Into<Option<FindOptions>> + Send>(
        &'life0 self,
        filter: F,
        options: O
    ) -> Pin<Box<dyn Future<Output = Result<TypeCursor<T>>> + Send + 'async_trait>>
    where
        F: 'async_trait,
        O: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn delete_item<'life0, 'async_trait, O: Into<Option<FindOneAndDeleteOptions>> + Send>(
        &'life0 self,
        filter: Document,
        options: O
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
    where
        O: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn delete_items<'life0, 'async_trait, O: Into<Option<DeleteOptions>> + Send>(
        &'life0 self,
        query: Document,
        options: O
    ) -> Pin<Box<dyn Future<Output = Result<DeleteResult>> + Send + 'async_trait>>
    where
        O: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn write_concern() -> Option<WriteConcern> { ... }
fn get_document(model: &T) -> Result<Document> { ... }
fn get_instance_from_document(document: Document) -> Result<T> { ... } }

Required methods

#[must_use]fn new<'async_trait>(
    database: Database
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>> where
    Self: 'async_trait, 

fn get_collection(&self) -> Collection

#[must_use]fn add_item<'life0, 'async_trait>(
    &'life0 self,
    filter: Option<Document>,
    item: T
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn add_many<'life0, 'async_trait, I: IntoIterator<Item = T> + Send, O: Into<Option<InsertManyOptions>> + Send>(
    &'life0 self,
    collection: I,
    options: O
) -> Pin<Box<dyn Future<Output = Result<InsertManyResult>> + Send + 'async_trait>> where
    I: 'async_trait,
    O: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn find_one<'life0, 'async_trait, F: Into<Option<Document>> + Send, O: Into<Option<FindOneOptions>> + Send>(
    &'life0 self,
    filter: F,
    options: O
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>> where
    F: 'async_trait,
    O: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn find<'life0, 'async_trait, F: Into<Option<Document>> + Send, O: Into<Option<FindOptions>> + Send>(
    &'life0 self,
    filter: F,
    options: O
) -> Pin<Box<dyn Future<Output = Result<TypeCursor<T>>> + Send + 'async_trait>> where
    F: 'async_trait,
    O: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn delete_item<'life0, 'async_trait, O: Into<Option<FindOneAndDeleteOptions>> + Send>(
    &'life0 self,
    filter: Document,
    options: O
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>> where
    O: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

#[must_use]fn delete_items<'life0, 'async_trait, O: Into<Option<DeleteOptions>> + Send>(
    &'life0 self,
    query: Document,
    options: O
) -> Pin<Box<dyn Future<Output = Result<DeleteResult>> + Send + 'async_trait>> where
    O: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

Loading content...

Provided methods

fn write_concern() -> Option<WriteConcern>

The model's write concern.

fn get_document(model: &T) -> Result<Document>

fn get_instance_from_document(document: Document) -> Result<T>

Loading content...

Implementors

impl<T: Model> RepositoryTrait<T> for GenericRepository<T>[src]

Loading content...