users

package
v1.35.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("user not found")
	ErrExists   = errors.New("user already exists")
)
View Source
var (
	ErrPasswordInvalid = errors.New("invalid password")
)

Functions

func CompareBCryptHash

func CompareBCryptHash(hash, password string) error

func MakeBCryptHash

func MakeBCryptHash(password string) (string, error)

func Migrate

func Migrate(db *gorm.DB) error

func Module

func Module() fx.Option

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	users *repository,
	cache *loginCache,
	logger *zap.Logger,
) *Service

func (*Service) ChangePassword

func (s *Service) ChangePassword(ctx context.Context, username, currentPassword, newPassword string) error

func (*Service) Create

func (s *Service) Create(username, password string) (*User, error)

func (*Service) GetByUsername

func (s *Service) GetByUsername(username string) (*User, error)

func (*Service) Login

func (s *Service) Login(ctx context.Context, username, password string) (*User, error)

type User

type User struct {
	ID string

	CreatedAt time.Time
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL