biz

package
v0.0.0-...-c2164b1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 9 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotFound is user not found.
	ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
)
View Source
var ProviderSet = wire.NewSet(NewUsercase)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type User

type User struct {
	Id         int64      `json:"id"`
	UserName   string     `json:"user_name"`
	Password   string     `json:"password"`
	Email      string     `json:"email"`
	Avatar     string     `json:"avatar"`
	Status     UserStatus `json:"status"`
	CreateTime int64      `json:"create_time"`
	DeleteTime int64      `json:"delete_time"`
}

func (*User) Encode

func (u *User) Encode() (string, error)

func (*User) UnEncode

func (u *User) UnEncode(data string) error

type UserRepo

type UserRepo interface {
	CreateUser(ctx context.Context, user *User) error
	UpdateUserInfo(ctx context.Context, userId int64, passwd string) error
	UpdateAvatar(ctx context.Context, userId int64, avatar string) error
	UpdateEmail(ctx context.Context, userId int64, email string) error
	FindByID(ctx context.Context, id int64) (*User, error)
	FindByUserName(ctx context.Context, userName string) (*User, error)
	CreateTokenLinkId(ctx context.Context, id int64, token string) error
	GetIdByToken(ctx context.Context, token string) (int64, error)
}

type UserStatus

type UserStatus int8

type UserUsecase

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

GreeterUsecase is a Greeter usecase.

func NewUsercase

func NewUsercase(repo UserRepo, logger log.Logger) *UserUsecase

NewGreeterUsecase new a Greeter usecase.

func (*UserUsecase) AuthByPwd

func (u *UserUsecase) AuthByPwd(ctx context.Context, username string, passwd string) (string, error)

缓存错误暂不处理

func (*UserUsecase) GetIdByToken

func (u *UserUsecase) GetIdByToken(ctx context.Context, token string) (int64, error)

func (*UserUsecase) Register

func (u *UserUsecase) Register(ctx context.Context, user *User) error

Register 创建并且生成token

Jump to

Keyboard shortcuts

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