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 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoginFailed    = errors.New("login failed")
	ErrPasswordFailed = errors.New("password failed")
	ErrUserDeactivate = errors.New("user is deactivated")
)
View Source
var (
	ErrUserNotFound = errors.New("user not found")
)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type AuthUseCase

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

func NewAuthUseCase

func NewAuthUseCase(conf *conf.Auth, userRepo UserRepo) *AuthUseCase

func (*AuthUseCase) Login

func (ac *AuthUseCase) Login(ctx context.Context, req *v1.LoginReq) (*v1.LoginReply, error)

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)
	VerifyPassword(ctx context.Context, u *User, password string) error
	ListUser(ctx context.Context, req *v1.ListUserReq) (*v1.ListUserReply, error)
	ChangeActive(ctx context.Context, id int64, active 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, id int64, active bool) (bool, error)

func (*UserUseCase) Get

func (uc *UserUseCase) Get(ctx context.Context, req *v1.GetUserReq) (*v1.GetUserReply, error)

func (*UserUseCase) List

func (uc *UserUseCase) List(ctx context.Context, req *v1.ListUserReq) (*v1.ListUserReply, error)

Jump to

Keyboard shortcuts

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