CrudRepository

Trait CrudRepository 

Source
pub trait CrudRepository {
Show 21 methods // Required methods fn collection_name(&self) -> String; fn database(&self) -> Box<&Database>; // Provided methods fn find_one<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find_by_id<'life0, 'life1, 'async_trait, T>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn find_by_string_id<'life0, 'life1, 'async_trait, T>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn find_one_by_string_field<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, name: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn find_by_string_field<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, name: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn find_all<'life0, 'async_trait, T>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find_simple<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find_with_sort<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, sort_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find<'life0, 'async_trait, T>( &'life0 self, filter_document: impl 'async_trait + Into<Option<Document>> + Send, options: impl 'async_trait + Into<Option<FindOptions>> + Send, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn count_documents<'life0, 'async_trait>( &'life0 self, filter: impl 'async_trait + Into<Option<Document>> + Send, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn aggregate<'life0, 'async_trait, T>( &'life0 self, pipeline: impl 'async_trait + IntoIterator<Item = Document> + Send, options: impl 'async_trait + Into<Option<AggregateOptions>> + Send, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn get_sort_find_option( &self, sort_document_option: Option<Document>, ) -> Option<FindOptions> { ... } fn _find_one_by_field<'life0, 'async_trait, T>( &'life0 self, field_name: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn add<'life0, 'async_trait, T>( &'life0 self, item: impl 'async_trait + Borrow<T> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<InsertOneResult, Error>> + Send + 'async_trait>> where T: Serialize + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn update_one<'life0, 'async_trait>( &'life0 self, query: Document, update: impl 'async_trait + Into<UpdateModifications> + Send + Sync, options: impl 'async_trait + Into<Option<UpdateOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<UpdateResult, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find_one_and_update<'life0, 'async_trait, T>( &'life0 self, filter: Document, update: impl 'async_trait + Into<UpdateModifications> + Send + Sync, options: impl 'async_trait + Into<Option<FindOneAndUpdateOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where for<'a> T: DeserializeOwned + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn find_one_and_replace<'life0, 'async_trait, T>( &'life0 self, filter: Document, replacement: impl 'async_trait + Borrow<T> + Send + Sync, options: impl 'async_trait + Into<Option<FindOneAndReplaceOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>> where T: Serialize + DeserializeOwned + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn replace_one<'life0, 'async_trait, T>( &'life0 self, query: Document, replacement: impl 'async_trait + Borrow<T> + Send + Sync, options: impl 'async_trait + Into<Option<ReplaceOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<UpdateResult, Error>> + Send + 'async_trait>> where for<'a> T: Serialize + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn delete_one<'life0, 'async_trait>( &'life0 self, query: Document, options: impl 'async_trait + Into<Option<DeleteOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<DeleteResult, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}

Required Methods§

Provided Methods§

Source

fn find_one<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find_by_id<'life0, 'life1, 'async_trait, T>( &'life0 self, id: &'life1 ObjectId, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn find_by_string_id<'life0, 'life1, 'async_trait, T>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn find_one_by_string_field<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, name: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn find_by_string_field<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, name: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn find_all<'life0, 'async_trait, T>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find_simple<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find_with_sort<'life0, 'async_trait, T>( &'life0 self, filter_document: Document, sort_document: Document, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find<'life0, 'async_trait, T>( &'life0 self, filter_document: impl 'async_trait + Into<Option<Document>> + Send, options: impl 'async_trait + Into<Option<FindOptions>> + Send, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn count_documents<'life0, 'async_trait>( &'life0 self, filter: impl 'async_trait + Into<Option<Document>> + Send, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn aggregate<'life0, 'async_trait, T>( &'life0 self, pipeline: impl 'async_trait + IntoIterator<Item = Document> + Send, options: impl 'async_trait + Into<Option<AggregateOptions>> + Send, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn get_sort_find_option( &self, sort_document_option: Option<Document>, ) -> Option<FindOptions>

Source

fn _find_one_by_field<'life0, 'async_trait, T>( &'life0 self, field_name: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Unpin + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn add<'life0, 'async_trait, T>( &'life0 self, item: impl 'async_trait + Borrow<T> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<InsertOneResult, Error>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn update_one<'life0, 'async_trait>( &'life0 self, query: Document, update: impl 'async_trait + Into<UpdateModifications> + Send + Sync, options: impl 'async_trait + Into<Option<UpdateOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<UpdateResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find_one_and_update<'life0, 'async_trait, T>( &'life0 self, filter: Document, update: impl 'async_trait + Into<UpdateModifications> + Send + Sync, options: impl 'async_trait + Into<Option<FindOneAndUpdateOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where for<'a> T: DeserializeOwned + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn find_one_and_replace<'life0, 'async_trait, T>( &'life0 self, filter: Document, replacement: impl 'async_trait + Borrow<T> + Send + Sync, options: impl 'async_trait + Into<Option<FindOneAndReplaceOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, Error>> + Send + 'async_trait>>
where T: Serialize + DeserializeOwned + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn replace_one<'life0, 'async_trait, T>( &'life0 self, query: Document, replacement: impl 'async_trait + Borrow<T> + Send + Sync, options: impl 'async_trait + Into<Option<ReplaceOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<UpdateResult, Error>> + Send + 'async_trait>>
where for<'a> T: Serialize + Send + Sync + 'async_trait, Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn delete_one<'life0, 'async_trait>( &'life0 self, query: Document, options: impl 'async_trait + Into<Option<DeleteOptions>> + Send + Sync, ) -> Pin<Box<dyn Future<Output = Result<DeleteResult, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

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§