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

Documentation

Index

Constants

View Source
const (
	FollowType   uint32 = 1
	UnfollowType uint32 = 2
)

Variables

View Source
var ErrInValidActionType = errors.New("invalid action type")

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

func (uc *RelationUseCase) GetFollowList(ctx context.Context, userId uint32) ([]*User, error)

GetFollowList 获取关注列表

func (*RelationUseCase) GetFollowerList

func (uc *RelationUseCase) GetFollowerList(ctx context.Context, userId uint32) ([]*User, error)

GetFollowerList 获取粉丝列表

func (*RelationUseCase) IsFollow

func (uc *RelationUseCase) IsFollow(ctx context.Context, userId uint32, toUserId []uint32) ([]bool, error)

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 // 点赞数量
}

Jump to

Keyboard shortcuts

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