Documentation
¶
Overview ¶
Package memory is an in-memory canopy.Store. It is useful for tests and for local development. It is not durable and it does not scale across processes. Use a persistent store such as store/postgres in production.
Index ¶
- type Store
- func (s *Store) AcceptInvitation(ctx context.Context, invitationID string, email string, now time.Time, ...) error
- func (s *Store) AddTeamMember(ctx context.Context, member *canopy.TeamMember) error
- func (s *Store) ApplyPasswordReset(ctx context.Context, identifier string, value string, now time.Time, ...) error
- func (s *Store) CleanupExpired(ctx context.Context, now time.Time) error
- func (s *Store) ClearActiveOrganization(ctx context.Context, orgID, userID string) error
- func (s *Store) ConsumeBackupCode(ctx context.Context, userID, codeHash string) (bool, error)
- func (s *Store) ConsumeTOTPStep(ctx context.Context, userID string, counter int64) (bool, error)
- func (s *Store) ConsumeVerification(ctx context.Context, identifier, value string, now time.Time) (*canopy.Verification, error)
- func (s *Store) CreateAccount(ctx context.Context, account *canopy.Account) error
- func (s *Store) CreateInvitation(ctx context.Context, invitation *canopy.Invitation) error
- func (s *Store) CreateLinkedAccount(ctx context.Context, identifier string, value string, now time.Time, ...) error
- func (s *Store) CreateMember(ctx context.Context, member *canopy.Member) error
- func (s *Store) CreateOrganization(ctx context.Context, org *canopy.Organization) error
- func (s *Store) CreateOrganizationWithOwner(ctx context.Context, org *canopy.Organization, owner *canopy.Member) error
- func (s *Store) CreateSession(ctx context.Context, session *canopy.Session) error
- func (s *Store) CreateTeam(ctx context.Context, team *canopy.Team) error
- func (s *Store) CreateUser(ctx context.Context, user *canopy.User) error
- func (s *Store) CreateUserAccount(ctx context.Context, user *canopy.User, account *canopy.Account) error
- func (s *Store) CreateVerification(ctx context.Context, v *canopy.Verification) error
- func (s *Store) DeleteExpiredSessions(ctx context.Context, now time.Time) error
- func (s *Store) DeleteExpiredVerifications(ctx context.Context, now time.Time) error
- func (s *Store) DeleteMember(ctx context.Context, orgID, userID string) error
- func (s *Store) DeleteOrganization(ctx context.Context, id string) error
- func (s *Store) DeleteSessionByToken(ctx context.Context, token string) error
- func (s *Store) DeleteTeam(ctx context.Context, orgID, teamID string) error
- func (s *Store) DeleteTwoFactor(ctx context.Context, userID string) error
- func (s *Store) DeleteUserSessions(ctx context.Context, userID string) error
- func (s *Store) DeleteVerificationsByIdentifier(ctx context.Context, identifier string) error
- func (s *Store) EnableTwoFactor(ctx context.Context, tf *canopy.TwoFactor, codeHashes []string) error
- func (s *Store) FindAccount(ctx context.Context, providerID, accountID string) (*canopy.Account, error)
- func (s *Store) FindAccountByUserProvider(ctx context.Context, userID, providerID string) (*canopy.Account, error)
- func (s *Store) FindInvitation(ctx context.Context, id string) (*canopy.Invitation, error)
- func (s *Store) FindMember(ctx context.Context, orgID, userID string) (*canopy.Member, error)
- func (s *Store) FindOrganizationByID(ctx context.Context, id string) (*canopy.Organization, error)
- func (s *Store) FindOrganizationBySlug(ctx context.Context, slug string) (*canopy.Organization, error)
- func (s *Store) FindSessionByToken(ctx context.Context, token string) (*canopy.SessionData, error)
- func (s *Store) FindTeamByID(ctx context.Context, id string) (*canopy.Team, error)
- func (s *Store) FindTeamMember(ctx context.Context, teamID, userID string) (*canopy.TeamMember, error)
- func (s *Store) FindUserByEmail(ctx context.Context, email string) (*canopy.User, error)
- func (s *Store) FindUserByID(ctx context.Context, id string) (*canopy.User, error)
- func (s *Store) GetTwoFactor(ctx context.Context, userID string) (*canopy.TwoFactor, error)
- func (s *Store) ListInvitationsForOrg(ctx context.Context, orgID string) ([]canopy.Invitation, error)
- func (s *Store) ListMembers(ctx context.Context, orgID string) ([]canopy.Member, error)
- func (s *Store) ListOrganizationsForUser(ctx context.Context, userID string) ([]canopy.Organization, error)
- func (s *Store) ListTeamMembers(ctx context.Context, teamID string) ([]canopy.TeamMember, error)
- func (s *Store) ListTeamsForOrg(ctx context.Context, orgID string) ([]canopy.Team, error)
- func (s *Store) ListUserSessions(ctx context.Context, userID string) ([]canopy.Session, error)
- func (s *Store) ListUsers(ctx context.Context, q canopy.UserQuery) ([]canopy.User, int, error)
- func (s *Store) RemoveMemberAndClearSessions(ctx context.Context, orgID, userID string, now time.Time) error
- func (s *Store) RemoveTeamMember(ctx context.Context, teamID, userID string) error
- func (s *Store) ReplaceBackupCodes(ctx context.Context, userID string, codeHashes []string) error
- func (s *Store) ReplaceVerification(ctx context.Context, v *canopy.Verification) error
- func (s *Store) UpdateAccount(ctx context.Context, account *canopy.Account) error
- func (s *Store) UpdateInvitation(ctx context.Context, invitation *canopy.Invitation) error
- func (s *Store) UpdateMember(ctx context.Context, member *canopy.Member) error
- func (s *Store) UpdateMemberRole(ctx context.Context, member *canopy.Member, protectedRole string) error
- func (s *Store) UpdateOrganization(ctx context.Context, org *canopy.Organization) error
- func (s *Store) UpdateSession(ctx context.Context, session *canopy.Session) error
- func (s *Store) UpdateTeam(ctx context.Context, team *canopy.Team) error
- func (s *Store) UpdateUser(ctx context.Context, user *canopy.User) error
- func (s *Store) UpsertTwoFactor(ctx context.Context, tf *canopy.TwoFactor) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory implementation of canopy.Store. It also implements the optional capability interfaces.
func (*Store) AcceptInvitation ¶
func (*Store) AddTeamMember ¶
func (*Store) ApplyPasswordReset ¶
func (s *Store) ApplyPasswordReset( ctx context.Context, identifier string, value string, now time.Time, account *canopy.Account, ) error
ApplyPasswordReset atomically consumes the reset token, updates the password account, revokes sessions, and invalidates every other reset token.
func (*Store) CleanupExpired ¶
CleanupExpired removes expired session and verification records atomically.
func (*Store) ClearActiveOrganization ¶
func (*Store) ConsumeBackupCode ¶
func (*Store) ConsumeTOTPStep ¶
func (*Store) ConsumeVerification ¶
func (*Store) CreateAccount ¶
func (*Store) CreateInvitation ¶
func (*Store) CreateLinkedAccount ¶
func (s *Store) CreateLinkedAccount( ctx context.Context, identifier string, value string, now time.Time, account *canopy.Account, ) error
CreateLinkedAccount atomically consumes the one-time link-confirmation verification and creates the provider account for the existing user.
func (*Store) CreateMember ¶
func (*Store) CreateOrganization ¶
func (*Store) CreateOrganizationWithOwner ¶
func (*Store) CreateSession ¶
func (*Store) CreateUserAccount ¶
func (*Store) CreateVerification ¶
func (*Store) DeleteExpiredSessions ¶
func (*Store) DeleteExpiredVerifications ¶
func (*Store) DeleteMember ¶
func (*Store) DeleteOrganization ¶
func (*Store) DeleteSessionByToken ¶
func (*Store) DeleteTeam ¶
DeleteTeam removes the team and its team memberships atomically.