Trait some_auth::AuthRepository

source ·
pub trait AuthRepository<TAuthUser: AuthUser + Debug + Send + Sync> {
    // Required methods
    fn add_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user: &'life1 TAuthUser,
    ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user: &'life1 TAuthUser,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_user<'life0, 'async_trait>(
        &'life0 self,
        id: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_user_by_username<'life0, 'life1, 'async_trait>(
        &'life0 self,
        username: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_user_refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: i32,
        token_hash: &'life1 str,
        time_updated: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_user_refresh_token<'life0, 'async_trait>(
        &'life0 self,
        user_id: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Auth repository which is used in [UserService]

Required Methods§

source

fn add_user<'life0, 'life1, 'async_trait>( &'life0 self, user: &'life1 TAuthUser, ) -> Pin<Box<dyn Future<Output = Result<i32, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

returns created id

source

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

source

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

source

fn get_user_by_username<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TAuthUser>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn update_user_refresh_token<'life0, 'life1, 'async_trait>( &'life0 self, user_id: i32, token_hash: &'life1 str, time_updated: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_user_refresh_token<'life0, 'async_trait>( &'life0 self, user_id: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

returns token’s hash

Implementors§