pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub async fn connect(database_url: &str) -> Result<Self>
pub async fn migrate(&self) -> Result<()>
pub fn pool(&self) -> &PgPool
Sourcepub async fn get_total_plugins(&self) -> Result<i64>
pub async fn get_total_plugins(&self) -> Result<i64>
Get total number of plugins
Sourcepub async fn get_total_downloads(&self) -> Result<i64>
pub async fn get_total_downloads(&self) -> Result<i64>
Get total downloads across all plugins
Sourcepub async fn get_total_users(&self) -> Result<i64>
pub async fn get_total_users(&self) -> Result<i64>
Get total number of users
Sourcepub async fn store_refresh_token_jti(
&self,
jti: &str,
user_id: Uuid,
expires_at: DateTime<Utc>,
) -> Result<()>
pub async fn store_refresh_token_jti( &self, jti: &str, user_id: Uuid, expires_at: DateTime<Utc>, ) -> Result<()>
Store a refresh token JTI for tracking (called on token creation)
Sourcepub async fn is_token_revoked(&self, jti: &str) -> Result<bool>
pub async fn is_token_revoked(&self, jti: &str) -> Result<bool>
Check if a refresh token JTI has been revoked
Sourcepub async fn revoke_token(&self, jti: &str, reason: &str) -> Result<()>
pub async fn revoke_token(&self, jti: &str, reason: &str) -> Result<()>
Revoke a refresh token JTI (called on logout or token refresh)
Sourcepub async fn revoke_all_user_tokens(
&self,
user_id: Uuid,
reason: &str,
) -> Result<u64>
pub async fn revoke_all_user_tokens( &self, user_id: Uuid, reason: &str, ) -> Result<u64>
Revoke all refresh tokens for a user (called on password change, security events)
Sourcepub async fn cleanup_expired_tokens(&self) -> Result<u64>
pub async fn cleanup_expired_tokens(&self) -> Result<u64>
Clean up expired token revocation records (for maintenance)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl !UnwindSafe for Database
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.