Skip to main content

DocumentRepository

Trait DocumentRepository 

Source
pub trait DocumentRepository<T>: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        collection: &'life1 CollectionName,
        id: &'life2 DocumentId,
        entity: &'life3 T,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolyglotError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn find<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 CollectionName,
        id: &'life2 DocumentId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>, PolyglotError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn replace<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        collection: &'life1 CollectionName,
        id: &'life2 DocumentId,
        entity: &'life3 T,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolyglotError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 CollectionName,
        id: &'life2 DocumentId,
    ) -> Pin<Box<dyn Future<Output = Result<bool, PolyglotError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 CollectionName,
        page: DocumentPage,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, PolyglotError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Portable document CRUD without pretending to expose relational semantics.

Required Methods§

Source

fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, collection: &'life1 CollectionName, id: &'life2 DocumentId, entity: &'life3 T, ) -> Pin<Box<dyn Future<Output = Result<(), PolyglotError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Creates a document and fails on an existing identifier.

Source

fn find<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 CollectionName, id: &'life2 DocumentId, ) -> Pin<Box<dyn Future<Output = Result<Option<T>, PolyglotError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Finds one document by its portable identifier.

Source

fn replace<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, collection: &'life1 CollectionName, id: &'life2 DocumentId, entity: &'life3 T, ) -> Pin<Box<dyn Future<Output = Result<(), PolyglotError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Replaces an existing document and fails if it does not exist.

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 CollectionName, id: &'life2 DocumentId, ) -> Pin<Box<dyn Future<Output = Result<bool, PolyglotError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes a document, returning whether it existed.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, collection: &'life1 CollectionName, page: DocumentPage, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, PolyglotError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lists a deterministic, bounded page ordered by document identifier.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§