svc

package
v0.0.0-...-2799c83 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(rd *redis.Redis) *Cache

func (*Cache) BatchSetReplyCount

func (c *Cache) BatchSetReplyCount(ctx context.Context, batch map[uint64]uint64) error

func (*Cache) DecrReplyCount

func (c *Cache) DecrReplyCount(ctx context.Context, oid uint64, decrement int64) error

func (*Cache) DecrReplyCountWhenExist

func (c *Cache) DecrReplyCountWhenExist(ctx context.Context, oid uint64, decrement int64) error

func (*Cache) DelPinned

func (c *Cache) DelPinned(ctx context.Context, oid uint64) error

func (*Cache) DelReplyCount

func (c *Cache) DelReplyCount(ctx context.Context, oid uint64) error

func (*Cache) GetPinned

func (c *Cache) GetPinned(ctx context.Context, oid uint64) (*comm.Model, error)

func (*Cache) GetReplyCount

func (c *Cache) GetReplyCount(ctx context.Context, oid uint64) (uint64, error)

被评论对象的评论数量

func (*Cache) IncrReplyCount

func (c *Cache) IncrReplyCount(ctx context.Context, oid uint64, increment int64) error

func (*Cache) IncrReplyCountWhenExist

func (c *Cache) IncrReplyCountWhenExist(ctx context.Context, oid uint64, increment int64) error

func (*Cache) SetPinned

func (c *Cache) SetPinned(ctx context.Context, model *comm.Model) error

func (*Cache) SetReplyCount

func (c *Cache) SetReplyCount(ctx context.Context, oid, count uint64) error

type CommentSvc

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

func NewCommentSvc

func NewCommentSvc(ctx *ServiceContext, repo *repo.Repo, cache *redis.Redis) *CommentSvc

func (*CommentSvc) ConsumeAddReplyEv

func (s *CommentSvc) ConsumeAddReplyEv(ctx context.Context, data *queue.AddReplyData) error

job related methods

func (*CommentSvc) ConsumeDelReplyEv

func (s *CommentSvc) ConsumeDelReplyEv(ctx context.Context, data *queue.DelReplyData) error

func (*CommentSvc) ConsumeLikeDislikeEv

func (s *CommentSvc) ConsumeLikeDislikeEv(ctx context.Context, data *queue.BinaryReplyData) error

处理点赞或者点踩 TODO 对接点赞系统

func (*CommentSvc) ConsumePinEv

func (s *CommentSvc) ConsumePinEv(ctx context.Context, data *queue.PinReplyData) error

置顶或者取消置顶 每个对象仅支持一条置顶评论,后置顶的评论会替代旧的置顶评论的置顶状态

func (*CommentSvc) CountReply

func (s *CommentSvc) CountReply(ctx context.Context, oid uint64) (uint64, error)

获取被评论对象oid的评论数量

func (*CommentSvc) FullSyncReplyCountCache

func (s *CommentSvc) FullSyncReplyCountCache(ctx context.Context) error

全量同步评论数量

func (*CommentSvc) GetPinnedReply

func (s *CommentSvc) GetPinnedReply(ctx context.Context, oid uint64) (*sdk.GetPinnedReplyRes, error)

func (*CommentSvc) PageGetObjectReplies

func (s *CommentSvc) PageGetObjectReplies(ctx context.Context, in *sdk.PageGetReplyReq) (*sdk.PageGetDetailedReplyRes, error)

获取评论信息,包含主评论和子评论

func (*CommentSvc) PageGetReply

func (s *CommentSvc) PageGetReply(ctx context.Context, in *sdk.PageGetReplyReq) (*sdk.PageGetReplyRes, error)

获取根评论

func (*CommentSvc) PageGetSubReply

func (s *CommentSvc) PageGetSubReply(ctx context.Context, in *sdk.PageGetSubReplyReq) (*sdk.PageGetSubReplyRes, error)

获取子评论

func (*CommentSvc) PartialSyncReplyCountCache

func (s *CommentSvc) PartialSyncReplyCountCache(ctx context.Context, offset, limit int64) error

func (*CommentSvc) ReplyAdd

func (s *CommentSvc) ReplyAdd(ctx context.Context, req *model.ReplyReq) (*model.ReplyRes, error)

发表评论

func (*CommentSvc) ReplyDel

func (s *CommentSvc) ReplyDel(ctx context.Context, rid uint64) error

func (*CommentSvc) ReplyDislike

func (s *CommentSvc) ReplyDislike(ctx context.Context, rid uint64, action int8) error

TODO 点踩/取消点踩

func (*CommentSvc) ReplyLike

func (s *CommentSvc) ReplyLike(ctx context.Context, rid uint64, action int8) error

TODO 点赞/取消点赞

func (*CommentSvc) ReplyPin

func (s *CommentSvc) ReplyPin(ctx context.Context, oid, rid uint64, action int8) error

置顶/取消置顶评论

type ServiceContext

type ServiceContext struct {
	Config     *config.Config
	CommentSvc *CommentSvc
}

func NewServiceContext

func NewServiceContext(c *config.Config) *ServiceContext

初始化一个service

Jump to

Keyboard shortcuts

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