pub struct MemoryDatabaseAdapter<U = User, S = Session, A = Account, O = Organization, M = Member, I = Invitation, V = Verification> { /* private fields */ }Expand description
In-memory database adapter for testing and development.
Generic over entity types — use default type parameters for the built-in
types, or supply your own custom structs that implement the Memory*
traits.
ⓘ
// Using built-in types (no turbofish needed):
let adapter = MemoryDatabaseAdapter::new();
// Using custom types:
let adapter = MemoryDatabaseAdapter::<MyUser, MySession, MyAccount,
MyOrg, MyMember, MyInvitation, MyVerification>::new();Implementations§
Source§impl MemoryDatabaseAdapter
Constructor for the default (built-in) entity types.
Use Default::default() for custom type parameterizations.
impl MemoryDatabaseAdapter
Constructor for the default (built-in) entity types.
Use Default::default() for custom type parameterizations.
Trait Implementations§
Source§impl<U, S, A, O, M, I, V> AccountOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> AccountOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Account = A
fn create_account<'life0, 'async_trait>(
&'life0 self,
create_account: CreateAccount,
) -> Pin<Box<dyn Future<Output = AuthResult<A>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_account<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: &'life1 str,
provider_account_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<A>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_user_accounts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<A>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_account<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<U, S, A, O, M, I, V> Default for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> Default for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
Source§impl<U, S, A, O, M, I, V> InvitationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> InvitationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Invitation = I
fn create_invitation<'life0, 'async_trait>(
&'life0 self,
create_inv: CreateInvitation,
) -> Pin<Box<dyn Future<Output = AuthResult<I>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_invitation_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<I>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_pending_invitation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
email: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<I>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_invitation_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
status: InvitationStatus,
) -> Pin<Box<dyn Future<Output = AuthResult<I>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_organization_invitations<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<I>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_user_invitations<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<I>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<U, S, A, O, M, I, V> MemberOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> MemberOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Member = M
fn create_member<'life0, 'async_trait>(
&'life0 self,
create_member: CreateMember,
) -> Pin<Box<dyn Future<Output = AuthResult<M>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_member<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
user_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<M>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_member_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<M>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_member_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
member_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<M>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_member<'life0, 'life1, 'async_trait>(
&'life0 self,
member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_organization_members<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<M>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count_organization_members<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count_organization_owners<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<U, S, A, O, M, I, V> OrganizationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> OrganizationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Organization = O
fn create_organization<'life0, 'async_trait>(
&'life0 self,
create_org: CreateOrganization,
) -> Pin<Box<dyn Future<Output = AuthResult<O>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_organization_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<O>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_organization_by_slug<'life0, 'life1, 'async_trait>(
&'life0 self,
slug: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<O>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_organization<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateOrganization,
) -> Pin<Box<dyn Future<Output = AuthResult<O>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_organization<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_user_organizations<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<O>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<U, S, A, O, M, I, V> SessionOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> SessionOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Session = S
fn create_session<'life0, 'async_trait>(
&'life0 self,
create_session: CreateSession,
) -> Pin<Box<dyn Future<Output = AuthResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<S>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<S>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_session_expiry<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_session<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_expired_sessions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_session_active_organization<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
organization_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = AuthResult<S>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl<U, S, A, O, M, I, V> UserOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> UserOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type User = U
fn create_user<'life0, 'async_trait>(
&'life0 self,
create_user: CreateUser,
) -> Pin<Box<dyn Future<Output = AuthResult<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_user_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_by_username<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<U>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateUser,
) -> Pin<Box<dyn Future<Output = AuthResult<U>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<U, S, A, O, M, I, V> VerificationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
impl<U, S, A, O, M, I, V> VerificationOps for MemoryDatabaseAdapter<U, S, A, O, M, I, V>where
U: MemoryUser,
S: MemorySession,
A: MemoryAccount,
O: MemoryOrganization,
M: MemoryMember,
I: MemoryInvitation,
V: MemoryVerification,
type Verification = V
fn create_verification<'life0, 'async_trait>(
&'life0 self,
create_verification: CreateVerification,
) -> Pin<Box<dyn Future<Output = AuthResult<V>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<V>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_verification_by_value<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<V>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_expired_verifications<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<U, S, A, O, M, I, V> Freeze for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> RefUnwindSafe for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> Send for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> Sync for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> Unpin for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
impl<U, S, A, O, M, I, V> UnwindSafe for MemoryDatabaseAdapter<U, S, A, O, M, I, V>
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