svc

package
v0.0.0-...-8103b37 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 29 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) CheckUserCommentOnObject

func (s *CommentSvc) CheckUserCommentOnObject(ctx context.Context, uid, oid uint64) (bool, error)

获取用户是否评论过某个对象

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

处理点赞或者点踩

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) DataProxy

func (s *CommentSvc) DataProxy() IDataProxy

func (*CommentSvc) FullSyncReplyCountCache

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

全量同步评论数量

func (*CommentSvc) GetPinnedReply

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

func (*CommentSvc) GetReplyDislikesCount

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

获取评论点踩数

func (*CommentSvc) GetReplyLikesCount

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

获取评论点赞数量

func (*CommentSvc) PageGetObjectReplies

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

func (*CommentSvc) PageGetReply

获取根评论

func (*CommentSvc) PageGetSubReply

获取子评论

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

点踩/取消点踩

func (*CommentSvc) ReplyLike

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

点赞/取消点赞

func (*CommentSvc) ReplyPin

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

置顶/取消置顶评论

type IDataProxy

type IDataProxy interface {
	AddReply(ctx context.Context, data *comm.Model) error
	DelReply(ctx context.Context, rid uint64, reply *comm.Model) error
	LikeReply(ctx context.Context, rid, uid uint64) error
	UnLikeReply(ctx context.Context, rid, uid uint64) error
	DisLikeReply(ctx context.Context, rid, uid uint64) error
	UnDisLikeReply(ctx context.Context, rid, uid uint64) error
	PinReply(ctx context.Context, oid, rid uint64) error
	UnPinReply(ctx context.Context, oid, rid uint64) 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