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: 19 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 struct info of Dao.

func New

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

New new a Dao and return.

func (*Dao) ActionCounter

func (d *Dao) ActionCounter(c context.Context, mid int64, ts int64) (actionCounter *model.ActionCounter, err error)

ActionCounter .

func (*Dao) CalcRecords

func (d *Dao) CalcRecords(c context.Context, mid int64, weekTSFrom, weekTSTo int64) (figureRecords []*model.FigureRecord, err error)

CalcRecords get it from hbase

func (*Dao) Close

func (d *Dao) Close()

Close close connections of mc, redis, db.

func (*Dao) Figure

func (d *Dao) Figure(c context.Context, mid int64) (figure *model.Figure, err error)

Figure get Figure from db

func (*Dao) FigureCache

func (d *Dao) FigureCache(c context.Context, mid int64) (figure *model.Figure, err error)

FigureCache get FigureUser from cache

func (*Dao) Figures

func (d *Dao) Figures(c context.Context, fromMid int64, limit int) (figures []*model.Figure, end bool, err error)

Figures get all figure info from formMid

func (*Dao) InsertRankHistory

func (d *Dao) InsertRankHistory(c context.Context, rank *model.Rank) (id int64, err error)

InsertRankHistory insert figure rank history to db

func (*Dao) PendingMidsCache

func (d *Dao) PendingMidsCache(c context.Context, version int64, shard int64) (mids []int64, err error)

PendingMidsCache get PendingUser set from cache

func (*Dao) Ping

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

Ping ping health of db.

func (*Dao) PingRedis

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

PingRedis check redis connection

func (*Dao) PutCalcRecord

func (d *Dao) PutCalcRecord(c context.Context, record *model.FigureRecord, weekTS int64) (err error)

PutCalcRecord put record all the params x.

func (*Dao) RemoveCache

func (d *Dao) RemoveCache(c context.Context, mid int64) (err error)

RemoveCache remove figure cache

func (*Dao) SetFigureCache

func (d *Dao) SetFigureCache(c context.Context, figure *model.Figure) (err error)

SetFigureCache set FigureUser to cache

func (*Dao) UpsertFigure

func (d *Dao) UpsertFigure(c context.Context, figure *model.Figure) (id int64, err error)

UpsertFigure insert or update(if mid duplicated) Figure

func (*Dao) UpsertRank

func (d *Dao) UpsertRank(c context.Context, rank *model.Rank) (id int64, err error)

UpsertRank insert or update figure rank to db

func (*Dao) UserInfo

func (d *Dao) UserInfo(c context.Context, mid int64, weekVer int64) (userInfo *model.UserInfo, err error)

UserInfo get it from hbase

type HBase

type HBase interface {
	UserInfo(c context.Context, mid int64, weekVer int64) (userInfo *model.UserInfo, err error)
	PutCalcRecord(c context.Context, record *model.FigureRecord, weekTS int64) (err error)
	CalcRecords(c context.Context, mid int64, weekTSFrom, weekTSTo int64) (figureRecords []*model.FigureRecord, err error)
	ActionCounter(c context.Context, mid int64, ts int64) (counter *model.ActionCounter, err error)
}

HBase dao hbase interface

type Int

type Int interface {
	HBase
	Mysql
	Redis
	Close()
	Ping(c context.Context) error
}

Int is dao interface

type Mysql

type Mysql interface {
	Figure(c context.Context, mid int64) (figure *model.Figure, err error)
	Figures(c context.Context, fromMid int64, limit int) (figures []*model.Figure, end bool, err error)
	UpsertFigure(c context.Context, figure *model.Figure) (id int64, err error)
	InsertRankHistory(c context.Context, rank *model.Rank) (id int64, err error)
	UpsertRank(c context.Context, rank *model.Rank) (id int64, err error)
}

Mysql dao mysql interface

type Redis

type Redis interface {
	FigureCache(c context.Context, mid int64) (figure *model.Figure, err error)
	SetFigureCache(c context.Context, figure *model.Figure) (err error)
	PendingMidsCache(c context.Context, version int64, shard int64) (mids []int64, err error)
	RemoveCache(c context.Context, mid int64) (err error)
}

Redis dao redis interface

Directories

Path Synopsis
Package mock_dao is a generated GoMock package.
Package mock_dao is a generated GoMock package.

Jump to

Keyboard shortcuts

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