Skip to main content

ExpenseRepository

Trait ExpenseRepository 

Source
pub trait ExpenseRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        expense: &'life1 Expense,
    ) -> Pin<Box<dyn Future<Output = Result<Expense, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn enregistrer_lignes_de_facture<'life0, 'life1, 'async_trait>(
        &'life0 self,
        expense_id: Uuid,
        lignes: &'life1 [LigneDeFacture],
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Expense>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Expense>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_all_paginated<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        page_request: &'life1 PageRequest,
        filters: &'life2 ExpenseFilters,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Expense>, i64), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        expense: &'life1 Expense,
    ) -> Pin<Box<dyn Future<Output = Result<Expense, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, expense: &'life1 Expense, ) -> Pin<Box<dyn Future<Output = Result<Expense, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn enregistrer_lignes_de_facture<'life0, 'life1, 'async_trait>( &'life0 self, expense_id: Uuid, lignes: &'life1 [LigneDeFacture], ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enregistre le détail d’une facture saisie ligne par ligne.

Pas de méthode par défaut, et c’est délibéré : une implémentation par défaut qui ne ferait rien reproduirait exactement le défaut qu’on corrige — accepter la donnée et la perdre en silence. Chaque implémentation doit dire ce qu’elle en fait, quitte à dire qu’elle n’en fait rien parce qu’elle est un mock.

Source

fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Expense>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Expense>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn find_all_paginated<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, page_request: &'life1 PageRequest, filters: &'life2 ExpenseFilters, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Expense>, i64), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Find all expenses with pagination and filters Returns tuple of (expenses, total_count)

Source

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

Source

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§