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

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoginFailed    = errors.New("login failed")
	ErrPasswordFailed = errors.New("password failed")
)
View Source
var (
	ErrUserNotFound    = errors.New("user not found")
	ErrUsernameInvalid = errors.New("username invalid")
	ErrPasswordInvalid = errors.New("password invalid")
)

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)

func (*AuthUseCase) Register

func (ac *AuthUseCase) Register(ctx context.Context, req *v1.RegisterReq) (*v1.RegisterReply, error)

type User

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

func NewUser

func NewUser(username, password string) (User, error)

type UserRepo

type UserRepo interface {
	FindByUsername(ctx context.Context, username string) (*User, error)
	VerifyPassword(ctx context.Context, u *User, password string) error
	Save(ctx context.Context, u *User) error
}

type UserUseCase

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

func NewUserUseCase

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

Jump to

Keyboard shortcuts

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