users

package
v0.0.0-...-4c6e0a9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID           string
	PasswordHash string
	UserName     string
}

type UserRepo

type UserRepo interface {
	Add(User) error
	Get(string) (User, error)
	Remove(string) error
	Update(User) error
}

GameRepo is an interface for a game repository.

func NewUserRepo

func NewUserRepo() UserRepo

NewGameRepo returns a new UserRepoStorage

type UserRepoStorage

type UserRepoStorage struct {
	Storage map[string]User
}

func (UserRepoStorage) Add

func (grs UserRepoStorage) Add(g User) error

Add adds a user to the repository.

func (UserRepoStorage) Get

func (grs UserRepoStorage) Get(id string) (User, error)

Get returns a user from the repository.

func (UserRepoStorage) Remove

func (grs UserRepoStorage) Remove(id string) error

Remove removes a user from the repository.

func (UserRepoStorage) Update

func (grs UserRepoStorage) Update(g User) error

Update updates a user in the repository.

type UserService

type UserService struct {
	UserRepo UserRepo
}

func NewUserService

func NewUserService(ur UserRepo) UserService

func (UserService) SignIn

func (us UserService) SignIn(username string, password string) (*User, error)

func (UserService) SignUp

func (us UserService) SignUp(username string, password string) (*User, error)

Jump to

Keyboard shortcuts

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