pub trait UserRepository<U: AuthenticatableUser = SimpleUser>: Send + Sync {
// Required methods
fn find_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_last_login<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn increment_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn reset_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn lock_account<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
locked_until: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn unlock_account<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exists_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Generic user repository trait for database operations
The generic type U must implement AuthenticatableUser.
Required Methods§
Sourcefn find_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find user by email address
Sourcefn find_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find user by ID
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create new user
Sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 U,
) -> Pin<Box<dyn Future<Output = Result<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update user
Sourcefn update_last_login<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_last_login<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update user’s last login timestamp
Sourcefn increment_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn increment_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Increment failed login attempts
Sourcefn reset_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset_failed_attempts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reset failed login attempts
Sourcefn lock_account<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
locked_until: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn lock_account<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 Uuid,
locked_until: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lock user account
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".