Documentation
¶
Index ¶
- Constants
- Variables
- func IsUniqueViolation(err error, constraint string) bool
- func NormalizeUsername(u string) string
- type Config
- type Store
- func (s *Store) ClaimNextEmailJob(ctx context.Context, now time.Time) (domain.EmailJob, error)
- func (s *Store) ConsumeChallenge(ctx context.Context, challengeID uuid.UUID, now time.Time) error
- func (s *Store) ConsumeRefreshToken(ctx context.Context, tokenID uuid.UUID, consumedAt time.Time) error
- func (s *Store) CreateAllowedEmail(ctx context.Context, email string) error
- func (s *Store) CreateAuthProvider(ctx context.Context, provider domain.AuthProvider) (domain.AuthProvider, error)
- func (s *Store) CreateChallenge(ctx context.Context, in domain.Challenge) (domain.Challenge, error)
- func (s *Store) CreateEmailJob(ctx context.Context, in domain.EmailJob) (domain.EmailJob, error)
- func (s *Store) CreatePendingSignupAction(ctx context.Context, in domain.PendingSignupAction) (domain.PendingSignupAction, error)
- func (s *Store) CreateRefreshToken(ctx context.Context, token domain.RefreshToken) error
- func (s *Store) CreateSession(ctx context.Context, session domain.Session) (domain.Session, error)
- func (s *Store) CreateUser(ctx context.Context, user domain.User) (domain.User, error)
- func (s *Store) CurrentSchemaVersion(ctx context.Context) (int, error)
- func (s *Store) DB() *gorm.DB
- func (s *Store) DeleteAllowedEmail(ctx context.Context, email string) error
- func (s *Store) DeleteExpiredRefreshTokens(ctx context.Context, now time.Time) error
- func (s *Store) DeleteExpiredSessions(ctx context.Context, now time.Time) error
- func (s *Store) DeleteFailedEmailJobsBefore(ctx context.Context, t time.Time) error
- func (s *Store) DeleteRefreshTokensBySession(ctx context.Context, sessionID uuid.UUID) error
- func (s *Store) DeleteSentEmailJobsBefore(ctx context.Context, t time.Time) error
- func (s *Store) DeleteUser(ctx context.Context, userID uuid.UUID) error
- func (s *Store) DisableUser(ctx context.Context, userID uuid.UUID, disabledAt time.Time) error
- func (s *Store) GetAuthProviderByMethodAndUserID(ctx context.Context, provider domain.Provider, userID uuid.UUID) (domain.AuthProvider, error)
- func (s *Store) GetAuthProviderByProviderAndProviderUserID(ctx context.Context, provider domain.Provider, providerUserID string) (domain.AuthProvider, error)
- func (s *Store) GetChallengeByID(ctx context.Context, challengeID uuid.UUID) (domain.Challenge, error)
- func (s *Store) GetPendingSignupActionByChallengeID(ctx context.Context, challengeID uuid.UUID) (domain.PendingSignupAction, error)
- func (s *Store) GetRefreshTokenByHash(ctx context.Context, hash string) (domain.RefreshToken, error)
- func (s *Store) GetSessionByID(ctx context.Context, sessionID uuid.UUID) (domain.Session, error)
- func (s *Store) GetUserByEmail(ctx context.Context, email string) (domain.User, error)
- func (s *Store) GetUserByID(ctx context.Context, userID uuid.UUID) (domain.User, error)
- func (s *Store) GetVerificationCodeByChallengeID(ctx context.Context, challengeID uuid.UUID) (domain.VerificationCode, error)
- func (s *Store) IncrementChallengeAttemptCount(ctx context.Context, challengeID uuid.UUID) error
- func (s *Store) IncrementChallengeResendCount(ctx context.Context, challengeID uuid.UUID, now time.Time) (bool, error)
- func (s *Store) IsEmailAllowed(ctx context.Context, email string) (bool, error)
- func (s *Store) IsUserAdmin(ctx context.Context, userID uuid.UUID) (bool, error)
- func (s *Store) IsUserDisabled(ctx context.Context, userID uuid.UUID) (bool, error)
- func (s *Store) MarkEmailJobFailed(ctx context.Context, jobID uuid.UUID, lastError string) error
- func (s *Store) MarkEmailJobSent(ctx context.Context, jobID uuid.UUID, now time.Time) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) RequeueEmailJob(ctx context.Context, jobID uuid.UUID, lastError string, ...) error
- func (s *Store) RevokeAllSessionsForUser(ctx context.Context, userID uuid.UUID, revokedAt time.Time) error
- func (s *Store) RevokeSession(ctx context.Context, sessionID uuid.UUID, revokedAt time.Time) error
- func (s *Store) SetChallengeLastSentAt(ctx context.Context, challengeID uuid.UUID, now time.Time) error
- func (s *Store) UpdateUsername(ctx context.Context, userID uuid.UUID, username string) error
- func (s *Store) UpsertVerificationCode(ctx context.Context, in domain.VerificationCode) error
- func (s *Store) UserExistsByEmail(ctx context.Context, email string) (bool, error)
Constants ¶
View Source
const ( TxKey contextKey = "store.tx.state" DbKey contextKey = "store.tx.db" )
View Source
const ( ConstraintUserEmail = "unique_user_email" ConstraintUserUsername = "unique_user_username" )
Variables ¶
View Source
var ( ErrUserNotFound = errors.New("user not found") ErrSessionNotFound = errors.New("session not found") ErrorAuthProviderNotFound = errors.New("auth_provider not found") ErrRefreshTokenNotFound = errors.New("refresh_token not found") ErrorChallengeNotFound = errors.New("challenge not found") ErrorVerificationCodeNotFound = errors.New("verification code not found") ErrorEmailJobNotFound = errors.New("email job not found") ErrorPendingSignupActionNotFound = errors.New("pending signup action not found") )
Functions ¶
func IsUniqueViolation ¶
func NormalizeUsername ¶
Types ¶
type Config ¶
type Config struct {
Host string
Port int
Username string
Password string
Database string
Timezone string
Schema string
LogSql bool
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime time.Duration
ConnMaxIdleTime time.Duration
}
Config is the configuration for the database.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ClaimNextEmailJob ¶ added in v0.1.12
func (*Store) ConsumeChallenge ¶ added in v0.1.12
func (*Store) ConsumeRefreshToken ¶
func (*Store) CreateAllowedEmail ¶ added in v0.1.10
func (*Store) CreateAuthProvider ¶
func (s *Store) CreateAuthProvider(ctx context.Context, provider domain.AuthProvider) (domain.AuthProvider, error)
func (*Store) CreateChallenge ¶ added in v0.1.12
func (*Store) CreateEmailJob ¶ added in v0.1.12
func (*Store) CreatePendingSignupAction ¶ added in v0.1.12
func (s *Store) CreatePendingSignupAction(ctx context.Context, in domain.PendingSignupAction) (domain.PendingSignupAction, error)
func (*Store) CreateRefreshToken ¶
func (*Store) CreateSession ¶
func (*Store) CreateUser ¶
func (*Store) CurrentSchemaVersion ¶
func (*Store) DeleteAllowedEmail ¶ added in v0.1.10
func (*Store) DeleteExpiredRefreshTokens ¶
func (*Store) DeleteExpiredSessions ¶
func (*Store) DeleteFailedEmailJobsBefore ¶ added in v0.1.12
func (*Store) DeleteRefreshTokensBySession ¶
func (*Store) DeleteSentEmailJobsBefore ¶ added in v0.1.12
func (*Store) DisableUser ¶
func (*Store) GetAuthProviderByMethodAndUserID ¶
func (*Store) GetAuthProviderByProviderAndProviderUserID ¶
func (*Store) GetChallengeByID ¶ added in v0.1.12
func (*Store) GetPendingSignupActionByChallengeID ¶ added in v0.1.12
func (*Store) GetRefreshTokenByHash ¶
func (*Store) GetSessionByID ¶
func (*Store) GetUserByEmail ¶
func (*Store) GetUserByID ¶
func (*Store) GetVerificationCodeByChallengeID ¶ added in v0.1.12
func (*Store) IncrementChallengeAttemptCount ¶ added in v0.1.12
func (*Store) IncrementChallengeResendCount ¶ added in v0.1.12
func (*Store) IsEmailAllowed ¶ added in v0.1.10
func (*Store) IsUserAdmin ¶
func (*Store) IsUserDisabled ¶
func (*Store) MarkEmailJobFailed ¶ added in v0.1.12
func (*Store) MarkEmailJobSent ¶ added in v0.1.12
func (*Store) RequeueEmailJob ¶ added in v0.1.12
func (*Store) RevokeAllSessionsForUser ¶
func (*Store) RevokeSession ¶
func (*Store) SetChallengeLastSentAt ¶ added in v0.1.12
func (*Store) UpdateUsername ¶
func (*Store) UpsertVerificationCode ¶ added in v0.1.12
Source Files
¶
Click to show internal directories.
Click to hide internal directories.