biz

package
v0.0.0-...-7d1b39b Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound = errors.New("无法找到此用户")
	ErrInternal     = errors.New("服务内部错误")
)
View Source
var ProviderSet = wire.NewSet(NewUserUsecase)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type RelationRepo

type RelationRepo interface {
	IsFollow(ctx context.Context, userId uint32, toUserId []uint32) ([]bool, error)
}

RelationRepo 定义向relation服务请求的方法集合

type User

type User struct {
	Id              uint32
	Username        string
	Password        string
	Name            string
	FollowCount     uint32
	FollowerCount   uint32
	Avatar          string
	BackgroundImage string
	Signature       string
	TotalFavorited  uint32
	WorkCount       uint32
	FavoriteCount   uint32
	IsFollow        bool
	Token           string
}

User is a user model.

type UserRepo

type UserRepo interface {
	Create(context.Context, *User) (*User, error)
	FindById(context.Context, uint32) (*User, error)
	FindByIds(context.Context, []uint32) ([]*User, error)
	FindKeyInfoByUsername(context.Context, string) (*User, error)
	RunUpdateFollowListener()
	RunUpdateFollowerListener()
	RunUpdateFavoriteListener()
	RunUpdateFavoredListener()
	RunUpdateWorkListener()
}

UserRepo 定义user存储的方法集合

type UserUsecase

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

UserUsecase 是user的用例

func NewUserUsecase

func NewUserUsecase(userRepo UserRepo, relationRepo RelationRepo, conf *conf.JWT, logger log.Logger) *UserUsecase

func (*UserUsecase) GetInfo

func (uc *UserUsecase) GetInfo(ctx context.Context, userId uint32) (*User, error)

GetInfo .

func (*UserUsecase) GetInfos

func (uc *UserUsecase) GetInfos(ctx context.Context, userId uint32, userIds []uint32) ([]*User, error)

GetInfos

func (*UserUsecase) Login

func (uc *UserUsecase) Login(ctx context.Context, username, password string) (*User, error)

Login .

func (*UserUsecase) Register

func (uc *UserUsecase) Register(ctx context.Context, username, password string) (*User, error)

Register .

Jump to

Keyboard shortcuts

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