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 {
	Businesses    map[int64]*model.Business
	BusinessNames map[string]*model.Business
	// contains filtered or unexported fields
}

Dao dao

func New

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

New init mysql db

func (*Dao) AddHistories

func (d *Dao) AddHistories(c context.Context, hs []*model.History) (err error)

AddHistories add histories to db

func (*Dao) AddHistoriesCache

func (d *Dao) AddHistoriesCache(c context.Context, hs []*pb.AddHistoryReq) (err error)

AddHistoriesCache add the user to redis.

func (*Dao) AddHistoryCache

func (d *Dao) AddHistoryCache(c context.Context, h *pb.AddHistoryReq) (err error)

AddHistoryCache add the history to redis.

func (*Dao) AddHistoryMessage

func (d *Dao) AddHistoryMessage(c context.Context, k int, msg []*model.Merge) (err error)

AddHistoryMessage .

func (*Dao) ClearAllHistory

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

ClearAllHistory clear all histories

func (*Dao) ClearHistory

func (d *Dao) ClearHistory(c context.Context, mid int64, businesses []string) (err error)

ClearHistory clear histories

func (*Dao) ClearHistoryCache

func (d *Dao) ClearHistoryCache(c context.Context, mid int64, businesses []string) (err error)

ClearHistoryCache clear the user redis.

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) DelCache

func (d *Dao) DelCache(c context.Context, business string, mid int64, aids []int64) (err error)

DelCache delete the history redis.

func (*Dao) DelHistoryCache

func (d *Dao) DelHistoryCache(c context.Context, arg *pb.DelHistoriesReq) (err error)

DelHistoryCache delete the history redis.

func (*Dao) DeleteHistories

func (d *Dao) DeleteHistories(c context.Context, h *pb.DelHistoriesReq) (err error)

DeleteHistories .

func (*Dao) Histories

func (d *Dao) Histories(c context.Context, business string, mid int64, ids []int64) (res map[int64]*model.History, err error)

Histories get histories by id

func (*Dao) HistoriesCache

func (d *Dao) HistoriesCache(c context.Context, mid int64, hs map[string][]int64) (res map[string]map[int64]*model.History, err error)

HistoriesCache return the user histories from redis.

func (*Dao) ListCacheByTime

func (d *Dao) ListCacheByTime(c context.Context, business string, mid int64, start int64) (aids []int64, err error)

ListCacheByTime get aids from redis where score.

func (*Dao) ListsCacheByTime

func (d *Dao) ListsCacheByTime(c context.Context, businesses []string, mid int64, viewAt, ps int64) (res map[string][]int64, err error)

ListsCacheByTime get aids from redis where score.

func (*Dao) Ping

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

Ping dao ping

func (*Dao) QueryBusinesses

func (d *Dao) QueryBusinesses(c context.Context) (res []*model.Business, err error)

QueryBusinesses business

func (*Dao) SetUserHideCache

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

SetUserHideCache set the user hide to redis.

func (*Dao) TrimCache

func (d *Dao) TrimCache(c context.Context, business string, mid int64, limit int) (err error)

TrimCache trim history.

func (*Dao) UpdateUserHide

func (d *Dao) UpdateUserHide(c context.Context, mid int64, hide bool) (err error)

UpdateUserHide update user hide

func (*Dao) UserHide

func (d *Dao) UserHide(c context.Context, mid int64) (hide bool, err error)

UserHide get user hide

func (*Dao) UserHideCache

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

UserHideCache return user hide state from redis.

func (*Dao) UserHistories

func (d *Dao) UserHistories(c context.Context, businesses []string, mid, viewAt, ps int64) (res map[string][]*model.History, err error)

UserHistories get histories by time

Jump to

Keyboard shortcuts

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