pub trait ReadRepository<T: AggregateRoot>: Send + Sync {
    // Required methods
    fn get_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: <T as Entity>::Id
    ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        skip: usize,
        take: usize
    ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn exists<'life0, 'async_trait>(
        &'life0 self,
        id: <T as Entity>::Id
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn is_empty<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for representing a read-only Repository.

Required Methods§

source

fn get_by_id<'life0, 'async_trait>( &'life0 self, id: <T as Entity>::Id ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Gets an entity with the given ID.

source

fn list<'life0, 'async_trait>( &'life0 self, skip: usize, take: usize ) -> Pin<Box<dyn Future<Output = Result<Vec<T>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Lists all entities within a given page.

source

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

Returns the total number of entities in the repository.

Provided Methods§

source

fn exists<'life0, 'async_trait>( &'life0 self, id: <T as Entity>::Id ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Checks whether an entity with the given ID exists in the repository.

source

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

Checks if the repository is empty.

Implementors§