service

package
v0.0.0-...-5122af3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUser             = errors.New("no user exists")
	ErrEmailAlreadyExists = errors.New("email already exists")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	UserID int
	Cash   int64
}

type User

type User struct {
	Email    string
	Password string
}

type UserRepo

type UserRepo interface {
	CreateUser(ctx context.Context, user models.User, tx *sqlx.Tx) (int, error)
	GetUser(ctx context.Context, email, password string) (models.User, error)
	ExistsEmail(ctx context.Context, email string) (bool, error)
	InTx(ctx context.Context, opts *sql.TxOptions, fn func(tx *sqlx.Tx) error) error
}

type UserService

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

func NewUserService

func NewUserService(
	repo *repository.UserDB,
	sm *session.Manager,
	cfg config.BalanceClient,
	log *zap.Logger,
) *UserService

func (*UserService) CheckSessionID

func (a *UserService) CheckSessionID(ctx context.Context, id *session.ID) (*session.Session, error)

func (*UserService) CreateAccount

func (a *UserService) CreateAccount(ctx context.Context, user *User) (*Account, error)

func (*UserService) DeleteSessionID

func (a *UserService) DeleteSessionID(ctx context.Context, id *session.ID) error

func (*UserService) GenerateSessionID

func (a *UserService) GenerateSessionID(ctx context.Context, login, password string) (*session.ID, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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