Skip to main content

Repository

Trait Repository 

Source
pub trait Repository: Send + Sync {
    type Entity: Send + Sync;
    type Id: Send + Sync;
    type Error: Send + Sync + Error;

    // Required methods
    fn pool(&self) -> &PgDbPool;
    fn find_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self::Entity>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_all<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Entity>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn insert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        entity: &'life1 Self::Entity,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Id, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        entity: &'life1 Self::Entity,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<i64, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Self::Id,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Associated Types§

Required Methods§

Source

fn pool(&self) -> &PgDbPool

Source

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

Source

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

Source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 Self::Entity, ) -> Pin<Box<dyn Future<Output = Result<Self::Id, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 Self::Entity, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 Self::Id, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

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

Provided Methods§

Source

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

Implementors§