Documentation
¶
Index ¶
- Constants
- Variables
- type RelationRepo
- type RelationUseCase
- func (uc *RelationUseCase) Action(ctx context.Context, toUserId uint32, actionType uint32) (err error)
- func (uc *RelationUseCase) GetFollowList(ctx context.Context, userId uint32) ([]*User, error)
- func (uc *RelationUseCase) GetFollowerList(ctx context.Context, userId uint32) ([]*User, error)
- func (uc *RelationUseCase) IsFollow(ctx context.Context, userId uint32, toUserId []uint32) ([]bool, error)
- type User
Constants ¶
View Source
const ( FollowType uint32 = 1 UnfollowType uint32 = 2 )
Variables ¶
View Source
var ErrInValidActionType = errors.New("invalid action type")
View Source
var ProviderSet = wire.NewSet(NewRelationUseCase)
Functions ¶
This section is empty.
Types ¶
type RelationRepo ¶
type RelationRepo interface { GetFollowList(context.Context, uint32) ([]*User, error) GetFollowerList(context.Context, uint32) ([]*User, error) Follow(context.Context, uint32) error UnFollow(context.Context, uint32) error IsFollow(ctx context.Context, userId uint32, toUserId []uint32) ([]bool, error) }
type RelationUseCase ¶
type RelationUseCase struct {
// contains filtered or unexported fields
}
func NewRelationUseCase ¶
func NewRelationUseCase(repo RelationRepo, logger log.Logger) *RelationUseCase
func (*RelationUseCase) Action ¶
func (uc *RelationUseCase) Action(ctx context.Context, toUserId uint32, actionType uint32) (err error)
Action 关注和取消关注
func (*RelationUseCase) GetFollowList ¶
GetFollowList 获取关注列表
func (*RelationUseCase) GetFollowerList ¶
GetFollowerList 获取粉丝列表
type User ¶
type User struct { Id uint32 // 用户id Name string // 用户名称 FollowCount uint32 // 关注总数 FollowerCount uint32 // 粉丝总数 IsFollow bool // true-已关注,false-未关注 Avatar string // 用户头像 BackgroundImage string // 用户个人页顶部大图 Signature string // 个人简介 TotalFavorite uint32 // 获赞数量 WorkCount uint32 // 作品数量 FavoriteCount uint32 // 点赞数量 }
Click to show internal directories.
Click to hide internal directories.