Documentation
¶
Index ¶
- func NewLinkingCodeRepository(dbConn *DB) interfaces.LinkingCodeRepository
- func NewOTPRepository(database *DB, cryptoService interfaces.CryptoService) interfaces.OTPRepository
- func NewUserRepository(dbConn *DB) interfaces.UserRepository
- func NewWebAuthnCredentialRepository(database *DB) interfaces.WebAuthnCredentialRepository
- func RunMigrations(cfg *config.Config) error
- type DB
- type HealthInfo
- type LinkingCodeRepository
- func (r *LinkingCodeRepository) CleanupExpired(ctx context.Context) error
- func (r *LinkingCodeRepository) Create(ctx context.Context, linkingCode *entities.LinkingCode) error
- func (r *LinkingCodeRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *LinkingCodeRepository) GetActiveByUserID(ctx context.Context, userID uuid.UUID) ([]*entities.LinkingCode, error)
- func (r *LinkingCodeRepository) GetByCode(ctx context.Context, code string) (*entities.LinkingCode, error)
- func (r *LinkingCodeRepository) GetByUserID(ctx context.Context, userID uuid.UUID) ([]*entities.LinkingCode, error)
- func (r *LinkingCodeRepository) Update(ctx context.Context, linkingCode *entities.LinkingCode) error
- type MigrationManager
- type UserRepository
- func (r *UserRepository) Create(ctx context.Context, user *entities.User) error
- func (r *UserRepository) Deactivate(ctx context.Context, userID uuid.UUID) error
- func (r *UserRepository) ExistsByEmail(ctx context.Context, email string) (bool, error)
- func (r *UserRepository) ExistsByUsername(ctx context.Context, username string) (bool, error)
- func (r *UserRepository) GetByEmail(ctx context.Context, email string) (*entities.User, error)
- func (r *UserRepository) GetByID(ctx context.Context, id uuid.UUID) (*entities.User, error)
- func (r *UserRepository) GetByUsername(ctx context.Context, username string) (*entities.User, error)
- func (r *UserRepository) Update(ctx context.Context, user *entities.User) error
- func (r *UserRepository) UpdateLastLogin(ctx context.Context, userID uuid.UUID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLinkingCodeRepository ¶
func NewLinkingCodeRepository(dbConn *DB) interfaces.LinkingCodeRepository
NewLinkingCodeRepository creates a new linking code repository
func NewOTPRepository ¶
func NewOTPRepository(database *DB, cryptoService interfaces.CryptoService) interfaces.OTPRepository
NewOTPRepository creates a new OTP repository
func NewUserRepository ¶
func NewUserRepository(dbConn *DB) interfaces.UserRepository
NewUserRepository creates a new user repository
func NewWebAuthnCredentialRepository ¶
func NewWebAuthnCredentialRepository(database *DB) interfaces.WebAuthnCredentialRepository
NewWebAuthnCredentialRepository creates a new WebAuthn credential repository
func RunMigrations ¶
RunMigrations is a convenience function to run migrations during application startup
Types ¶
type DB ¶
DB wraps the pgxpool.Pool with additional functionality
type HealthInfo ¶
type HealthInfo struct {
Status string `json:"status"`
Message string `json:"message"`
AcquiredConns int `json:"acquired_conns"`
IdleConns int `json:"idle_conns"`
MaxConns int `json:"max_conns"`
TotalConns int `json:"total_conns"`
NewConnsCount int64 `json:"new_conns_count"`
AcquireCount int64 `json:"acquire_count"`
AcquireDuration time.Duration `json:"acquire_duration"`
EmptyAcquireCount int64 `json:"empty_acquire_count"`
CanceledAcquireCount int64 `json:"canceled_acquire_count"`
}
HealthInfo contains database health information
type LinkingCodeRepository ¶
type LinkingCodeRepository struct {
// contains filtered or unexported fields
}
LinkingCodeRepository implements the domain linking code repository interface
func (*LinkingCodeRepository) CleanupExpired ¶
func (r *LinkingCodeRepository) CleanupExpired(ctx context.Context) error
CleanupExpired removes all expired linking codes
func (*LinkingCodeRepository) Create ¶
func (r *LinkingCodeRepository) Create(ctx context.Context, linkingCode *entities.LinkingCode) error
Create creates a new linking code
func (*LinkingCodeRepository) GetActiveByUserID ¶
func (r *LinkingCodeRepository) GetActiveByUserID(ctx context.Context, userID uuid.UUID) ([]*entities.LinkingCode, error)
GetActiveByUserID retrieves all active (valid) linking codes for a user
func (*LinkingCodeRepository) GetByCode ¶
func (r *LinkingCodeRepository) GetByCode(ctx context.Context, code string) (*entities.LinkingCode, error)
GetByCode retrieves a linking code by its code
func (*LinkingCodeRepository) GetByUserID ¶
func (r *LinkingCodeRepository) GetByUserID(ctx context.Context, userID uuid.UUID) ([]*entities.LinkingCode, error)
GetByUserID retrieves all linking codes for a user
func (*LinkingCodeRepository) Update ¶
func (r *LinkingCodeRepository) Update(ctx context.Context, linkingCode *entities.LinkingCode) error
Update updates an existing linking code
type MigrationManager ¶
type MigrationManager struct {
// contains filtered or unexported fields
}
MigrationManager handles database migrations
func NewMigrationManager ¶
func NewMigrationManager(cfg *config.Config) (*MigrationManager, error)
NewMigrationManager creates a new migration manager
func (*MigrationManager) Close ¶
func (m *MigrationManager) Close() error
Close closes the migration manager database connection
func (*MigrationManager) Create ¶
func (m *MigrationManager) Create(name string) error
Create creates a new migration file
func (*MigrationManager) Status ¶
func (m *MigrationManager) Status() error
Status shows the migration status
func (*MigrationManager) Version ¶
func (m *MigrationManager) Version() (int64, error)
Version shows the current migration version
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository implements the domain user repository interface
func (*UserRepository) Deactivate ¶
Deactivate marks a user as inactive (soft delete)
func (*UserRepository) ExistsByEmail ¶
ExistsByEmail checks if a user exists by email
func (*UserRepository) ExistsByUsername ¶
ExistsByUsername checks if a user exists by username
func (*UserRepository) GetByEmail ¶
GetByEmail retrieves a user by email
func (*UserRepository) GetByUsername ¶
func (r *UserRepository) GetByUsername(ctx context.Context, username string) (*entities.User, error)
GetByUsername retrieves a user by username
func (*UserRepository) UpdateLastLogin ¶
UpdateLastLogin updates the user's last login timestamp