logic

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SEGLOCK_LENGTH = 100

Variables

View Source
var Lock = new(SegLock)

Functions

This section is empty.

Types

type AddCatPopularityLogic added in v1.1.3

type AddCatPopularityLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewAddCatPopularityLogic added in v1.1.3

func NewAddCatPopularityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddCatPopularityLogic

func (*AddCatPopularityLogic) AddCatPopularity added in v1.1.3

type AddScoreLogic added in v1.1.3

type AddScoreLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewAddScoreLogic added in v1.1.3

func NewAddScoreLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddScoreLogic

func (*AddScoreLogic) AddScore added in v1.1.3

func (l *AddScoreLogic) AddScore(in *pb.AddScoreReq) (*pb.AddScoreResp, error)

type DailyUpdateLogic added in v1.1.3

type DailyUpdateLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewDailyUpdateLogic added in v1.1.3

func NewDailyUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DailyUpdateLogic

func (*DailyUpdateLogic) DailyUpdate added in v1.1.3

func (l *DailyUpdateLogic) DailyUpdate(in *pb.DailyUpdateReq) (*pb.DailyUpdateResp, error)

type DoLikeLogic

type DoLikeLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewDoLikeLogic

func NewDoLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DoLikeLogic

func (*DoLikeLogic) DoLike

func (l *DoLikeLogic) DoLike(in *pb.DoLikeReq) (*pb.DoLikeResp, error)

DoLike 点赞/取消赞

type GetLikedUsersLogic added in v1.1.5

type GetLikedUsersLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetLikedUsersLogic added in v1.1.5

func NewGetLikedUsersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLikedUsersLogic

func (*GetLikedUsersLogic) GetLikedUsers added in v1.1.5

func (l *GetLikedUsersLogic) GetLikedUsers(in *pb.GetLikedUsersReq) (*pb.GetLikedUsersResp, error)

查看喜欢某个东西的用户

type GetTargetLikesLogic

type GetTargetLikesLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetTargetLikesLogic

func NewGetTargetLikesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTargetLikesLogic

func (*GetTargetLikesLogic) GetTargetLikes

GetTargetLikes 获取目标点赞数

type GetTopKLogic added in v1.1.3

type GetTopKLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetTopKLogic added in v1.1.3

func NewGetTopKLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTopKLogic

func (*GetTopKLogic) GetTopK added in v1.1.3

func (l *GetTopKLogic) GetTopK(in *pb.GetTopKReq) (*pb.GetTopKResp, error)

GetTopK

函数逻辑: Range == 1 时,直接从 Redis 访问当日数据 Range > 1 时,拼出 cacheKey 在 Redis 里取数据,若不存在,访问数据库提取数据入 Redis。 访问 Redis 前进行分段加锁,把 cacheKey hash 到一个数,作为 id ,对此 id 的锁加锁, 目的是过滤重复请求,相同请求同一时刻只有一个打入数据库,同时分段数量限制了最大数据库并发量,顺带缓解缓存雪崩问题

type GetUserLikeLogic

type GetUserLikeLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetUserLikeLogic

func NewGetUserLikeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLikeLogic

func (*GetUserLikeLogic) GetUserLike

func (l *GetUserLikeLogic) GetUserLike(in *pb.GetUserLikedReq) (*pb.GetUserLikedResp, error)

GetUserLike 获取用户是否点赞

type GetUserLikesLogic added in v1.1.5

type GetUserLikesLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewGetUserLikesLogic added in v1.1.5

func NewGetUserLikesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserLikesLogic

func (*GetUserLikesLogic) GetUserLikes added in v1.1.5

func (l *GetUserLikesLogic) GetUserLikes(in *pb.GetUserLikesReq) (*pb.GetUserLikesResp, error)

查看用户点赞列表

type ListCatPopularityLogic added in v1.1.3

type ListCatPopularityLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewListCatPopularityLogic added in v1.1.3

func NewListCatPopularityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListCatPopularityLogic

func (*ListCatPopularityLogic) ListCatPopularity added in v1.1.3

popularity

type ListTopCatLogic added in v1.1.3

type ListTopCatLogic struct {
	logx.Logger
	// contains filtered or unexported fields
}

func NewListTopCatLogic added in v1.1.3

func NewListTopCatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListTopCatLogic

func (*ListTopCatLogic) ListTopCat added in v1.1.3

func (l *ListTopCatLogic) ListTopCat(in *pb.ListTopCatReq) (*pb.ListTopCatResp, error)

type SegLock added in v1.1.4

type SegLock [SEGLOCK_LENGTH]sync.Mutex

Jump to

Keyboard shortcuts

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