like

package
v0.0.0-...-8070279 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelData

type DelData struct {
	LikeId  string
	UserIds []string
}

type ICacheLike

type ICacheLike interface {
	AsyncStorage() //异步入库
}

func NewStorage

func NewStorage(redisKey string, action IStorageAction) ICacheLike

入库操作方法 传入IStorageAction进行mysql入库操作

type ILike

type ILike interface {
	Like(likeId string, userId string) (err error)
	UnLike(likeId string, userId string) (err error)
	IsLike(likeId string, userId string) (flag bool, err error)
	Count(likeId string) (count int64, err error)
}

点赞接口

func NewLike

func NewLike(ctx context.Context, opt *Option) ILike

type IStorageAction

type IStorageAction interface {
	Like(insertList []InsertData)            //入库为赞的操作
	UnLike(delData DelData)                  //入库为取消赞时的操作
	InsOrUpCount(likeId string, count int64) //入库修改数量
}

type InsertData

type InsertData struct {
	LikeId string
	UserId string

	CustomAttr g.MapStrAny
	// contains filtered or unexported fields
}

type Option

type Option struct {
	RedisKey       string                                         //redis key前缀
	CustomAttrFunc func(likeId string, userId string) g.MapStrAny //自定义增量属性hash的数据 用于异步入库时使用
}

Jump to

Keyboard shortcuts

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