Documentation
¶
Index ¶
- type AccountRepository
- type BunAccountRepository
- func (r *BunAccountRepository) Create(ctx context.Context, account *models.Account) (*models.Account, error)
- func (r *BunAccountRepository) GetByID(ctx context.Context, id string) (*models.Account, error)
- func (r *BunAccountRepository) GetByProviderAndAccountID(ctx context.Context, provider, accountID string) (*models.Account, error)
- func (r *BunAccountRepository) GetByUserID(ctx context.Context, userID string) (*models.Account, error)
- func (r *BunAccountRepository) GetByUserIDAndProvider(ctx context.Context, userID, provider string) (*models.Account, error)
- func (r *BunAccountRepository) Update(ctx context.Context, account *models.Account) (*models.Account, error)
- func (r *BunAccountRepository) UpdateFields(ctx context.Context, userID string, fields map[string]any) error
- func (r *BunAccountRepository) WithTx(tx bun.IDB) AccountRepository
- type BunSessionRepository
- func (r *BunSessionRepository) Create(ctx context.Context, session *models.Session) (*models.Session, error)
- func (r *BunSessionRepository) Delete(ctx context.Context, id string) error
- func (r *BunSessionRepository) DeleteByUserID(ctx context.Context, userID string) error
- func (r *BunSessionRepository) DeleteExpired(ctx context.Context) error
- func (r *BunSessionRepository) DeleteOldestByUserID(ctx context.Context, userID string, maxCount int) error
- func (r *BunSessionRepository) GetByID(ctx context.Context, id string) (*models.Session, error)
- func (r *BunSessionRepository) GetByToken(ctx context.Context, token string) (*models.Session, error)
- func (r *BunSessionRepository) GetByUserID(ctx context.Context, userID string) (*models.Session, error)
- func (r *BunSessionRepository) GetDistinctUserIDs(ctx context.Context) ([]string, error)
- func (r *BunSessionRepository) Update(ctx context.Context, session *models.Session) (*models.Session, error)
- func (r *BunSessionRepository) WithTx(tx bun.IDB) SessionRepository
- type BunUserRepository
- func (r *BunUserRepository) Create(ctx context.Context, user *models.User) (*models.User, error)
- func (r *BunUserRepository) GetByEmail(ctx context.Context, email string) (*models.User, error)
- func (r *BunUserRepository) GetByID(ctx context.Context, id string) (*models.User, error)
- func (r *BunUserRepository) Update(ctx context.Context, user *models.User) (*models.User, error)
- func (r *BunUserRepository) UpdateFields(ctx context.Context, id string, fields map[string]any) error
- func (r *BunUserRepository) WithTx(tx bun.IDB) UserRepository
- type BunVerificationRepository
- func (r *BunVerificationRepository) Create(ctx context.Context, verification *models.Verification) (*models.Verification, error)
- func (r *BunVerificationRepository) Delete(ctx context.Context, id string) error
- func (r *BunVerificationRepository) DeleteByUserIDAndType(ctx context.Context, userID string, vType models.VerificationType) error
- func (r *BunVerificationRepository) DeleteExpired(ctx context.Context) error
- func (r *BunVerificationRepository) GetByID(ctx context.Context, id string) (*models.Verification, error)
- func (r *BunVerificationRepository) GetByToken(ctx context.Context, token string) (*models.Verification, error)
- func (r *BunVerificationRepository) WithTx(tx bun.IDB) VerificationRepository
- type CryptoTokenRepositoryImpl
- type SessionRepository
- type TokenRepository
- type Transaction
- type UserRepository
- type VerificationRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountRepository ¶
type AccountRepository interface {
GetByID(ctx context.Context, id string) (*models.Account, error)
GetByUserID(ctx context.Context, userID string) (*models.Account, error)
GetByUserIDAndProvider(ctx context.Context, userID string, provider string) (*models.Account, error)
GetByProviderAndAccountID(ctx context.Context, provider string, accountID string) (*models.Account, error)
Create(ctx context.Context, account *models.Account) (*models.Account, error)
Update(ctx context.Context, account *models.Account) (*models.Account, error)
UpdateFields(ctx context.Context, userID string, fields map[string]any) error
WithTx(tx bun.IDB) AccountRepository
}
func NewBunAccountRepository ¶
func NewBunAccountRepository(db bun.IDB) AccountRepository
type BunAccountRepository ¶
type BunAccountRepository struct {
// contains filtered or unexported fields
}
func (*BunAccountRepository) GetByProviderAndAccountID ¶
func (*BunAccountRepository) GetByUserID ¶
func (*BunAccountRepository) GetByUserIDAndProvider ¶
func (*BunAccountRepository) UpdateFields ¶
func (*BunAccountRepository) WithTx ¶
func (r *BunAccountRepository) WithTx(tx bun.IDB) AccountRepository
type BunSessionRepository ¶
type BunSessionRepository struct {
// contains filtered or unexported fields
}
func (*BunSessionRepository) Delete ¶
func (r *BunSessionRepository) Delete(ctx context.Context, id string) error
func (*BunSessionRepository) DeleteByUserID ¶
func (r *BunSessionRepository) DeleteByUserID(ctx context.Context, userID string) error
func (*BunSessionRepository) DeleteExpired ¶ added in v2.10.0
func (r *BunSessionRepository) DeleteExpired(ctx context.Context) error
func (*BunSessionRepository) DeleteOldestByUserID ¶ added in v2.10.0
func (*BunSessionRepository) GetByToken ¶
func (*BunSessionRepository) GetByUserID ¶
func (*BunSessionRepository) GetDistinctUserIDs ¶ added in v2.9.0
func (r *BunSessionRepository) GetDistinctUserIDs(ctx context.Context) ([]string, error)
func (*BunSessionRepository) WithTx ¶
func (r *BunSessionRepository) WithTx(tx bun.IDB) SessionRepository
type BunUserRepository ¶
type BunUserRepository struct {
// contains filtered or unexported fields
}
func (*BunUserRepository) GetByEmail ¶
func (*BunUserRepository) UpdateFields ¶
func (*BunUserRepository) WithTx ¶
func (r *BunUserRepository) WithTx(tx bun.IDB) UserRepository
type BunVerificationRepository ¶
type BunVerificationRepository struct {
// contains filtered or unexported fields
}
func (*BunVerificationRepository) Create ¶
func (r *BunVerificationRepository) Create(ctx context.Context, verification *models.Verification) (*models.Verification, error)
func (*BunVerificationRepository) Delete ¶
func (r *BunVerificationRepository) Delete(ctx context.Context, id string) error
func (*BunVerificationRepository) DeleteByUserIDAndType ¶
func (r *BunVerificationRepository) DeleteByUserIDAndType(ctx context.Context, userID string, vType models.VerificationType) error
func (*BunVerificationRepository) DeleteExpired ¶ added in v2.10.0
func (r *BunVerificationRepository) DeleteExpired(ctx context.Context) error
func (*BunVerificationRepository) GetByID ¶
func (r *BunVerificationRepository) GetByID(ctx context.Context, id string) (*models.Verification, error)
func (*BunVerificationRepository) GetByToken ¶
func (r *BunVerificationRepository) GetByToken(ctx context.Context, token string) (*models.Verification, error)
func (*BunVerificationRepository) WithTx ¶
func (r *BunVerificationRepository) WithTx(tx bun.IDB) VerificationRepository
type CryptoTokenRepositoryImpl ¶
type CryptoTokenRepositoryImpl struct {
// contains filtered or unexported fields
}
CryptoTokenRepositoryImpl implements TokenRepository using modern crypto
func (*CryptoTokenRepositoryImpl) Decrypt ¶
func (r *CryptoTokenRepositoryImpl) Decrypt(encrypted string) (string, error)
Decrypt decrypts a token
func (*CryptoTokenRepositoryImpl) Encrypt ¶
func (r *CryptoTokenRepositoryImpl) Encrypt(token string) (string, error)
Encrypt encrypts a token Format: base64url([nonce_24][ciphertext+tag])
func (*CryptoTokenRepositoryImpl) Generate ¶
func (r *CryptoTokenRepositoryImpl) Generate() (string, error)
Generate generates a random 256-bit token encoded as hex
func (*CryptoTokenRepositoryImpl) Hash ¶
func (r *CryptoTokenRepositoryImpl) Hash(token string) string
Hash creates a SHA256 hash of the token (for DB storage)
type SessionRepository ¶
type SessionRepository interface {
GetByID(ctx context.Context, id string) (*models.Session, error)
GetByToken(ctx context.Context, token string) (*models.Session, error)
GetByUserID(ctx context.Context, userID string) (*models.Session, error)
Create(ctx context.Context, session *models.Session) (*models.Session, error)
Update(ctx context.Context, session *models.Session) (*models.Session, error)
Delete(ctx context.Context, id string) error
DeleteByUserID(ctx context.Context, userID string) error
DeleteExpired(ctx context.Context) error
DeleteOldestByUserID(ctx context.Context, userID string, maxCount int) error
GetDistinctUserIDs(ctx context.Context) ([]string, error)
WithTx(tx bun.IDB) SessionRepository
}
func NewBunSessionRepository ¶
func NewBunSessionRepository(db bun.IDB) SessionRepository
type TokenRepository ¶
type TokenRepository interface {
Generate() (string, error)
Hash(token string) string
Encrypt(token string) (string, error)
Decrypt(encrypted string) (string, error)
}
func NewCryptoTokenRepository ¶
func NewCryptoTokenRepository(secret string) TokenRepository
NewCryptoTokenRepository creates a new crypto token repository secret must be at least 32 bytes of high-entropy data
type Transaction ¶
type Transaction interface{}
Transaction represents a database transaction interface
type UserRepository ¶
type UserRepository interface {
GetByID(ctx context.Context, id string) (*models.User, error)
GetByEmail(ctx context.Context, email string) (*models.User, error)
Create(ctx context.Context, user *models.User) (*models.User, error)
Update(ctx context.Context, user *models.User) (*models.User, error)
UpdateFields(ctx context.Context, id string, fields map[string]any) error
WithTx(tx bun.IDB) UserRepository
}
func NewBunUserRepository ¶
func NewBunUserRepository(db bun.IDB) UserRepository
type VerificationRepository ¶
type VerificationRepository interface {
GetByID(ctx context.Context, id string) (*models.Verification, error)
GetByToken(ctx context.Context, token string) (*models.Verification, error)
Create(ctx context.Context, verification *models.Verification) (*models.Verification, error)
Delete(ctx context.Context, id string) error
DeleteByUserIDAndType(ctx context.Context, userID string, vType models.VerificationType) error
DeleteExpired(ctx context.Context) error
WithTx(tx bun.IDB) VerificationRepository
}
func NewBunVerificationRepository ¶
func NewBunVerificationRepository(db bun.IDB) VerificationRepository
Click to show internal directories.
Click to hide internal directories.