biz

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

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

Go to latest
Published: Jun 30, 2022 License: MIT, MIT Imports: 6 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound = errors.New("user not found")
)
View Source
var ProviderSet = wire.NewSet(NewUserUseCase)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type User

type User struct {
	Id       int64
	Username string
	Password string
	IsActive bool
}

type UserRepo

type UserRepo interface {
	GetUser(ctx context.Context, id int64) (*User, error)
	FindByUsername(ctx context.Context, username string) (*User, error)
	CreateUser(ctx context.Context, u *User) (*User, error)
	VerifyPassword(ctx context.Context, u *User) (bool, error)
	ListUser(ctx context.Context, pageIndex, pageSize int) ([]*User, int, error)
	ChangeActive(ctx context.Context, u *User, isActive bool) (bool, error)
}

type UserUseCase

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

func NewUserUseCase

func NewUserUseCase(repo UserRepo, logger log.Logger) *UserUseCase

func (*UserUseCase) ChangeActive

func (uc *UserUseCase) ChangeActive(ctx context.Context, req *v1.ChangeActiveReq) (*v1.ChangeActiveReply, error)

func (*UserUseCase) Create

func (uc *UserUseCase) Create(ctx context.Context, u *User) (*User, error)

func (*UserUseCase) Get

func (uc *UserUseCase) Get(ctx context.Context, id int64) (*User, error)

func (*UserUseCase) GetUserByUsername

func (uc *UserUseCase) GetUserByUsername(ctx context.Context, req *v1.GetUserByUsernameReq) (*v1.GetUserByUsernameReply, error)

func (*UserUseCase) List

func (uc *UserUseCase) List(ctx context.Context, pageIndex, pageSize int) ([]*User, int, error)

func (*UserUseCase) Save

func (uc *UserUseCase) Save(ctx context.Context, req *v1.SaveUserReq) (*v1.SaveUserReply, error)

func (*UserUseCase) VerifyPassword

func (uc *UserUseCase) VerifyPassword(ctx context.Context, u *User) (bool, error)

Jump to

Keyboard shortcuts

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