pub struct PostgresStore {
pub pool: PgPool,
}Expand description
Postgres-backed storage adapter.
Wrap a PgPool and pass this to [AuthxState::new].
Fields§
§pool: PgPoolImplementations§
Trait Implementations§
Source§impl ApiKeyRepository for PostgresStore
impl ApiKeyRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateApiKey,
) -> Pin<Box<dyn Future<Output = Result<ApiKey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
key_hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ApiKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<ApiKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revoke<'life0, 'async_trait>(
&'life0 self,
key_id: Uuid,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn touch_last_used<'life0, 'async_trait>(
&'life0 self,
key_id: Uuid,
at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl AuditLogRepository for PostgresStore
impl AuditLogRepository for PostgresStore
fn append<'life0, 'async_trait>(
&'life0 self,
entry: CreateAuditLog,
) -> Pin<Box<dyn Future<Output = Result<AuditLog>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditLog>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_org<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditLog>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl AuthorizationCodeRepository for PostgresStore
impl AuthorizationCodeRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateAuthorizationCode,
) -> Pin<Box<dyn Future<Output = Result<AuthorizationCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_code_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthorizationCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_used<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Clone for PostgresStore
impl Clone for PostgresStore
Source§fn clone(&self) -> PostgresStore
fn clone(&self) -> PostgresStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CredentialRepository for PostgresStore
impl CredentialRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateCredential,
) -> Pin<Box<dyn Future<Output = Result<Credential>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_password_hash<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_user_and_kind<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
kind: CredentialKind,
) -> Pin<Box<dyn Future<Output = Result<Option<Credential>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_by_user_and_kind<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
kind: CredentialKind,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl DeviceCodeRepository for PostgresStore
impl DeviceCodeRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateDeviceCode,
) -> Pin<Box<dyn Future<Output = Result<DeviceCode>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_device_code_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_user_code_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DeviceCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn deny<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_last_polled<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
interval_secs: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_by_client<'life0, 'life1, 'async_trait>(
&'life0 self,
client_id: &'life1 str,
offset: u32,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<DeviceCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl InviteRepository for PostgresStore
impl InviteRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateInvite,
) -> Pin<Box<dyn Future<Output = Result<Invite>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_token_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Invite>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn accept<'life0, 'async_trait>(
&'life0 self,
invite_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Invite>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl OAuthAccountRepository for PostgresStore
impl OAuthAccountRepository for PostgresStore
fn upsert<'life0, 'async_trait>(
&'life0 self,
data: UpsertOAuthAccount,
) -> Pin<Box<dyn Future<Output = Result<OAuthAccount>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_provider<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: &'life1 str,
provider_user_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<OAuthAccount>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn find_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<OAuthAccount>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl OidcClientRepository for PostgresStore
impl OidcClientRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateOidcClient,
) -> Pin<Box<dyn Future<Output = Result<OidcClient>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_client_id<'life0, 'life1, 'async_trait>(
&'life0 self,
client_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<OidcClient>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
offset: u32,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<OidcClient>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl OidcFederationProviderRepository for PostgresStore
impl OidcFederationProviderRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateOidcFederationProvider,
) -> Pin<Box<dyn Future<Output = Result<OidcFederationProvider>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<OidcFederationProvider>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_name<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<OidcFederationProvider>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_enabled<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<OidcFederationProvider>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl OidcTokenRepository for PostgresStore
impl OidcTokenRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateOidcToken,
) -> Pin<Box<dyn Future<Output = Result<OidcToken>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_token_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<OidcToken>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn revoke_all_for_user_client<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: Uuid,
client_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl OrgRepository for PostgresStore
impl OrgRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateOrg,
) -> Pin<Box<dyn Future<Output = Result<Organization>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Organization>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_slug<'life0, 'life1, 'async_trait>(
&'life0 self,
slug: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Organization>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_member<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
user_id: Uuid,
role_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Membership>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_member<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_members<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Membership>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_roles<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Role>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_role<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
name: String,
permissions: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Role>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_member_role<'life0, 'async_trait>(
&'life0 self,
org_id: Uuid,
user_id: Uuid,
role_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Membership>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl SessionRepository for PostgresStore
impl SessionRepository for PostgresStore
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateSession,
) -> Pin<Box<dyn Future<Output = Result<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_token_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invalidate<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invalidate_all_for_user<'life0, 'async_trait>(
&'life0 self,
user_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_org<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
org_id: Option<Uuid>,
) -> Pin<Box<dyn Future<Output = Result<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl UserRepository for PostgresStore
impl UserRepository for PostgresStore
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_username<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
offset: u32,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
data: CreateUser,
) -> Pin<Box<dyn Future<Output = Result<User>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
data: UpdateUser,
) -> Pin<Box<dyn Future<Output = Result<User>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for PostgresStore
impl !RefUnwindSafe for PostgresStore
impl Send for PostgresStore
impl Sync for PostgresStore
impl Unpin for PostgresStore
impl UnsafeUnpin for PostgresStore
impl !UnwindSafe for PostgresStore
Blanket Implementations§
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 more