users

package
v0.0.0-...-d18dbcb Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmailRequired      = errors.New("email is required")
	ErrInvalidEmail       = errors.New("email must be valid")
	ErrPasswordRequired   = errors.New("password is required")
	ErrPasswordTooShort   = errors.New("password must be at least 8 characters")
	ErrEmailAlreadyExists = errors.New("email is already registered")
	ErrInvalidCredentials = errors.New("invalid email or password")
	ErrSessionExpired     = errors.New("session has expired")
)

Functions

This section is empty.

Types

type Service

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

func NewService

func NewService(store *data.Store) *Service

func (*Service) AuthenticateSession

func (s *Service) AuthenticateSession(ctx context.Context, sessionToken string) (User, bool, error)

func (*Service) ListUsersForViewer

func (s *Service) ListUsersForViewer(ctx context.Context, viewer User) ([]User, error)

func (*Service) Login

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

func (*Service) Logout

func (s *Service) Logout(ctx context.Context, sessionToken string) error

func (*Service) Register

func (s *Service) Register(ctx context.Context, email string, password string) (User, error)

type User

type User struct {
	ID        string
	Email     string
	Role      string
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (User) IsAdmin

func (u User) IsAdmin() bool

Jump to

Keyboard shortcuts

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