dao

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RelationAPI *relation_api.Client

RelationAPI relation liverpc client

View Source
var RoomAPI *room_api.Client

RoomAPI room liverpc client

Functions

func StartRefreshJob

func StartRefreshJob()

StartRefreshJob 更新在线房间信息

func StartRoomFeatureJob

func StartRoomFeatureJob(c *conf.Config)

StartRoomFeatureJob 更新在线房间的特征信息

Types

type Counter

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

Counter 房间-分数结构体, 用于构建一个可排序的slice

type Dao

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

Dao dao

func New

func New(c *conf.Config) (dao *Dao)

New init mysql db

func (*Dao) ClearRecommend

func (d *Dao) ClearRecommend(ctx context.Context, uid int64) error

ClearRecommend 清空该用户相关的推荐缓存

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) FilterOnlineRoomIds

func (d *Dao) FilterOnlineRoomIds(roomIds []int64) (ret []int64)

FilterOnlineRoomIds 给定一批room id 返回所有在线的

func (*Dao) GetLrRecRoomIds

func (d *Dao) GetLrRecRoomIds(r redis.Conn, uid int64, candidateIds []int64) (ret []int64, err error)

GetLrRecRoomIds 在GetRandomRoomIds的基础上进行LR计算并返回倒排的房间号列表 与GetRandomRoomIds有相同的输入输出结构

func (*Dao) GetRandomRoomIds

func (d *Dao) GetRandomRoomIds(ctx context.Context, uid int64, reqCount int, existRoomIDs []int64) (ret []int64, err error)

GetRandomRoomIds 随机获取count个推荐 如果总数量total比count小,则返回total个

func (*Dao) Ping

func (d *Dao) Ping(ctx context.Context) (err error)

Ping dao ping

type ScoreSlice

type ScoreSlice []Counter

ScoreSlice Counter对象的slice

func (ScoreSlice) Len

func (s ScoreSlice) Len() int

func (ScoreSlice) Less

func (s ScoreSlice) Less(i, j int) bool

func (ScoreSlice) Swap

func (s ScoreSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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