Skip to main content

DocumentRepo

Trait DocumentRepo 

Source
pub trait DocumentRepo<T>: Send + Sync {
    type Id: Send + Sync + Clone + 'static;

    // Required methods
    fn find_all(&self) -> DataFuture<'_, Result<Vec<T>, DataError>>;
    fn find_by_id(
        &self,
        id: Self::Id,
    ) -> DataFuture<'_, Result<Option<T>, DataError>>;
    fn insert(&self, doc: T) -> DataFuture<'_, Result<T, DataError>>;
    fn update(
        &self,
        id: Self::Id,
        doc: T,
    ) -> DataFuture<'_, Result<T, DataError>>;
    fn delete(&self, id: Self::Id) -> DataFuture<'_, Result<(), DataError>>;
}

Required Associated Types§

Source

type Id: Send + Sync + Clone + 'static

Required Methods§

Source

fn find_all(&self) -> DataFuture<'_, Result<Vec<T>, DataError>>

Source

fn find_by_id( &self, id: Self::Id, ) -> DataFuture<'_, Result<Option<T>, DataError>>

Source

fn insert(&self, doc: T) -> DataFuture<'_, Result<T, DataError>>

Source

fn update(&self, id: Self::Id, doc: T) -> DataFuture<'_, Result<T, DataError>>

Source

fn delete(&self, id: Self::Id) -> DataFuture<'_, Result<(), DataError>>

Implementors§