Documentation ¶
Overview ¶
Package redis provides ...
Package redis provides ...
Package redis provides ...
Package redis provides ...
Index ¶
- Constants
- Variables
- func Close()
- func CreatePost(postID, communityID int64) error
- func GetAToken(userID string) (redisToken string, err error)
- func GetCommunityPostIDsInOrder(p *models.ParamPostList) ([]string, error)
- func GetPostIDsInOrder(p *models.ParamPostList) ([]string, error)
- func GetPostVoteData(ids []string) (data []int64, err error)
- func Init(cfg *settings.RedisConfig) (err error)
- func SetAToken(userID string, aToken string) error
- func VoteForPost(userID, postID string, value float64) error
Constants ¶
View Source
const ( Prefix = "bluebell:" KeyPostTimeZSet = "post:time" // zset: 贴子及发帖的时间 KeyPostScoreZSet = "post:score" // zset: 贴子及投票的分数 KeyPostVotedZSetPrefix = "post:voted:" // zset: 记录用户以投票类型,参数是 psot id KeyUserAccessTokenSetPrefix = "user:accessToken:" // set 记录用户登录时的accessToken KeyCommunitySetPrefis = "community:" // set:保存每个分区下帖子的id )
Variables ¶
View Source
var ( ErrVoteTimeExpire = errors.New("投票时间已过") ErrVoteRepeated = errors.New("不允许重复投票") )
View Source
var (
ErrorKeyNotExist = errors.New("token不存在,请登录")
)
Functions ¶
func GetCommunityPostIDsInOrder ¶
func GetCommunityPostIDsInOrder(p *models.ParamPostList) ([]string, error)
GetCommunityPostIDsInOrder 按社区查询ids
func GetPostIDsInOrder ¶
func GetPostIDsInOrder(p *models.ParamPostList) ([]string, error)
GetPostIDsInOrder 获取指定区间的帖子id,并按分数(根据参数决定 分数/时间)从高到低排序
func GetPostVoteData ¶
GetPostVoteData 根据ids查询每篇帖子的投赞成票的数据 注意当使用for循环发送查询的时候注意使用pipeline减少发送请求的RTT
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.