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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (d *Dao) AddReplySetRds(ctx context.Context, oid int64, tp int, rpID int64) (err error)

AddReplySetRds add a reply into redis set, make sure expire the key first.

func (*Dao) AddReplyZSetRds

func (d *Dao) AddReplyZSetRds(ctx context.Context, name string, oid int64, tp int, rs *model.ReplyScore) (err error)

AddReplyZSetRds add a reply into redis sorted set, make sure expire the key first.

func (*Dao) AddUV

func (d *Dao) AddUV(ctx context.Context, action string, hour, slot int, mid int64, kind string) (err error)

AddUV ...

func (*Dao) CheckerTsRds

func (d *Dao) CheckerTsRds(ctx context.Context, oid int64, tp int) (ts int64, err error)

CheckerTsRds get refresh checker timestamp from redis, if time.Now()-ts > strategy.time, then refresh reply list.

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) CountUV

func (d *Dao) CountUV(ctx context.Context, keys []string) (counts []int64, err error)

CountUV ...

func (*Dao) DelReplySetRds

func (d *Dao) DelReplySetRds(ctx context.Context, oid int64, tp int) (err error)

DelReplySetRds delete a set key.

func (*Dao) DelReplyZSetRds

func (d *Dao) DelReplyZSetRds(ctx context.Context, names []string, oid int64, tp int) (err error)

DelReplyZSetRds del a key from reply ZSet.

func (*Dao) ExpireCheckerRds

func (d *Dao) ExpireCheckerRds(ctx context.Context, oid int64, tp int) (ok bool, err error)

ExpireCheckerRds expire checker.

func (*Dao) ExpireReplySetRds

func (d *Dao) ExpireReplySetRds(ctx context.Context, oid int64, tp int) (ok bool, err error)

ExpireReplySetRds expire reply set.

func (*Dao) ExpireReplyZSetRds

func (d *Dao) ExpireReplyZSetRds(ctx context.Context, name string, oid int64, tp int) (ok bool, err error)

ExpireReplyZSetRds expire reply list.

func (*Dao) IsOriginHot

func (d *Dao) IsOriginHot(ctx context.Context, oid, rpID int64, tp int) (isHot bool, err error)

IsOriginHot return is origin hot reply.

func (*Dao) KeyUV

func (d *Dao) KeyUV(action string, hour, slot int, kind string) string

KeyUV ...

func (*Dao) Ping

func (d *Dao) Ping(c context.Context) error

Ping dao ping

func (*Dao) PingMc

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

PingMc ping

func (*Dao) PingRedis

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

PingRedis redis health check.

func (*Dao) RangeReplyZSetRds

func (d *Dao) RangeReplyZSetRds(ctx context.Context, name string, oid int64, tp, start, end int) (rpIDs []int64, err error)

RangeReplyZSetRds ...

func (*Dao) RemReplySetRds

func (d *Dao) RemReplySetRds(ctx context.Context, oid, rpID int64, tp int) (err error)

RemReplySetRds remove one rp from set.

func (*Dao) RemReplyStatMc

func (d *Dao) RemReplyStatMc(ctx context.Context, rpID int64) (err error)

RemReplyStatMc ...

func (*Dao) RemReplyZSetRds

func (d *Dao) RemReplyZSetRds(ctx context.Context, name string, oid int64, tp int, rpID int64) (err error)

RemReplyZSetRds remove one rpID from reply ZSet.

func (*Dao) ReplyLHRCStats

func (d *Dao) ReplyLHRCStats(ctx context.Context, oid int64, tp int) (replyMap map[int64]*model.ReplyStat, err error)

ReplyLHRCStats get reply like, hate, reply, ctime stat from database, only get root reply which like>3, call it when back to source.

func (*Dao) ReplyLHRCStatsByID

func (d *Dao) ReplyLHRCStatsByID(ctx context.Context, oid int64, rpIDs []int64) (replyMap map[int64]*model.ReplyStat, err error)

ReplyLHRCStatsByID return a reply like hate reply ctime stat by rpid.

func (*Dao) ReplySetRds

func (d *Dao) ReplySetRds(ctx context.Context, oid int64, tp int) (rpIDs []int64, err error)

ReplySetRds get reply rpIDs from redis set.

func (*Dao) ReplyStatsMc

func (d *Dao) ReplyStatsMc(ctx context.Context, rpIDs []int64) (rsMap map[int64]*model.ReplyStat, missIDs []int64, err error)

ReplyStatsMc get multi repies stat from memcache.

func (*Dao) ReplyZSetRds

func (d *Dao) ReplyZSetRds(ctx context.Context, name string, oid int64, tp, start, end int) (rpIDs []int64, err error)

ReplyZSetRds get reply list from redis sorted set.

func (*Dao) ReportStatsByID

func (d *Dao) ReportStatsByID(ctx context.Context, oid int64, rpIDs []int64) (reportMap map[int64]*model.ReplyStat, err error)

ReportStatsByID get report stats from database by ID

func (*Dao) RpIDs

func (d *Dao) RpIDs(ctx context.Context, oid int64, tp int) (rpIDs []int64, err error)

RpIDs return rpIDs should in hot reply list.

func (*Dao) SetCheckerTsRds

func (d *Dao) SetCheckerTsRds(ctx context.Context, oid int64, tp int) (err error)

SetCheckerTsRds set refresh checker's timestamp as time.Now(), call it when refresh reply list.

func (*Dao) SetReplySetRds

func (d *Dao) SetReplySetRds(ctx context.Context, oid int64, tp int, rpIDs []int64) (err error)

SetReplySetRds set reply list batch, call it when back to source.

func (*Dao) SetReplyStatMc

func (d *Dao) SetReplyStatMc(ctx context.Context, rs *model.ReplyStat) (err error)

SetReplyStatMc set reply stat into mc.

func (*Dao) SetReplyZSetRds

func (d *Dao) SetReplyZSetRds(ctx context.Context, name string, oid int64, tp int, rs []*model.ReplyScore) (err error)

SetReplyZSetRds set reply list batch, call it when back to source.

func (*Dao) SlotStats

func (d *Dao) SlotStats(ctx context.Context) (ss []*model.SlotStat, err error)

SlotStats get slot stat

func (*Dao) SlotsMapping

func (d *Dao) SlotsMapping(ctx context.Context) (slotsMap map[string]*model.SlotsMapping, err error)

SlotsMapping get slots and name mapping.

func (*Dao) SubjectStats

func (d *Dao) SubjectStats(ctx context.Context, oid int64, tp int) (ctime xtime.Time, err error)

SubjectStats get subject ctime from database

func (*Dao) UpsertStatistics

func (d *Dao) UpsertStatistics(ctx context.Context, name string, date, hour int, s *model.StatisticsStat) (err error)

UpsertStatistics insert or update statistics into database

Jump to

Keyboard shortcuts

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