Documentation
¶
Index ¶
- type Record
- type Repository
- func (r *Repository) ConsumeReset(ctx context.Context, jti string, usedAt time.Time) error
- func (r *Repository) CreateReset(ctx context.Context, record types.PasswordResetRecord) (*types.PasswordResetRecord, error)
- func (r *Repository) GetResetByJTI(ctx context.Context, jti string) (*types.PasswordResetRecord, error)
- func (r *Repository) UpdateResetStatus(ctx context.Context, jti string, status types.PasswordResetStatus, ...) error
- type RepositoryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct {
bun.BaseModel `bun:"table:password_reset"`
ID uuid.UUID `bun:"id,pk,type:uuid"`
UserID uuid.UUID `bun:"user_id,notnull,type:uuid"`
Email string `bun:"email,notnull"`
Status string `bun:"status,notnull"`
JTI string `bun:"jti"`
IssuedAt *time.Time `bun:"issued_at,nullzero"`
ExpiresAt *time.Time `bun:"expires_at,nullzero"`
UsedAt *time.Time `bun:"used_at,nullzero"`
ResetedAt *time.Time `bun:"reseted_at,nullzero"`
ScopeTenantID uuid.UUID `bun:"scope_tenant_id,type:uuid,nullzero"`
ScopeOrgID uuid.UUID `bun:"scope_org_id,type:uuid,nullzero"`
CreatedAt *time.Time `bun:"created_at,nullzero"`
DeletedAt *time.Time `bun:"deleted_at,soft_delete,nullzero"`
UpdatedAt *time.Time `bun:"updated_at,nullzero"`
}
Record models the persisted password_reset row.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository implements types.PasswordResetRepository using Bun.
func NewRepository ¶
func NewRepository(cfg RepositoryConfig) (*Repository, error)
NewRepository constructs the default password reset repository.
func (*Repository) ConsumeReset ¶
ConsumeReset marks the reset token as used, enforcing single-use semantics.
func (*Repository) CreateReset ¶
func (r *Repository) CreateReset(ctx context.Context, record types.PasswordResetRecord) (*types.PasswordResetRecord, error)
CreateReset persists a password reset record.
func (*Repository) GetResetByJTI ¶
func (r *Repository) GetResetByJTI(ctx context.Context, jti string) (*types.PasswordResetRecord, error)
GetResetByJTI returns the password reset record for a JTI.
func (*Repository) UpdateResetStatus ¶
func (r *Repository) UpdateResetStatus(ctx context.Context, jti string, status types.PasswordResetStatus, usedAt time.Time) error
UpdateResetStatus updates reset status and usage timestamp.
type RepositoryConfig ¶
type RepositoryConfig struct {
DB *bun.DB
Repository repository.Repository[*Record]
Clock types.Clock
}
RepositoryConfig wires the Bun-backed password reset repository.
Click to show internal directories.
Click to hide internal directories.