Documentation ¶
Index ¶
- Variables
- type RelationRepo
- type User
- type UserRepo
- type UserUsecase
- func (uc *UserUsecase) GetInfo(ctx context.Context, userId uint32) (*User, error)
- func (uc *UserUsecase) GetInfos(ctx context.Context, userId uint32, userIds []uint32) ([]*User, error)
- func (uc *UserUsecase) Login(ctx context.Context, username, password string) (*User, error)
- func (uc *UserUsecase) Register(ctx context.Context, username, password string) (*User, error)
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) GetInfos ¶
func (uc *UserUsecase) GetInfos(ctx context.Context, userId uint32, userIds []uint32) ([]*User, error)
GetInfos
Click to show internal directories.
Click to hide internal directories.