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

Documentation

Index

Constants

View Source
const (

	// RetryUpdateStatCache .
	RetryUpdateStatCache = 1
	// RetryUpdateStatDB .
	RetryUpdateStatDB = 2
	// RetryStatCount is retry upper limit.
	RetryStatCount = 10

	// RetryAddArtCache .
	RetryAddArtCache = 1
	// RetryUpdateArtCache .
	RetryUpdateArtCache = 2
	// RetryDeleteArtCache .
	RetryDeleteArtCache = 3
	// RetryDeleteArtRecCache .
	RetryDeleteArtRecCache = 4
)

Variables

This section is empty.

Functions

func PromError

func PromError(name string)

PromError prometheus error count.

func PromInfo

func PromInfo(name string)

PromInfo prometheus info count.

Types

type CacheRetry

type CacheRetry struct {
	Action int   `json:"action"`
	Aid    int64 `json:"aid"`
	Mid    int64 `json:"mid"`
	Cid    int64 `json:"cid"`
}

CacheRetry struct of retry cache info.

type Dao

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

Dao .

func New

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

New creates a dao instance.

func (*Dao) AddAuthorMostCategories

func (d *Dao) AddAuthorMostCategories(c context.Context, mid int64, categories []int64) (err error)

AddAuthorMostCategories .

func (*Dao) AddCacheGameList

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

AddCacheGameList .

func (*Dao) AddSortCaches

func (d *Dao) AddSortCaches(c context.Context, categoryID int64, field int, arts [][2]int64, maxLength int64) (err error)

AddSortCaches add sort articles cache

func (*Dao) AddcategoriesAuthors

func (d *Dao) AddcategoriesAuthors(c context.Context, data map[int64][]int64) (err error)

AddcategoriesAuthors .

func (*Dao) ArticleContent

func (d *Dao) ArticleContent(c context.Context, id int64) (res string, err error)

ArticleContent get article content

func (*Dao) CacheGameList

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

CacheGameList .

func (*Dao) CheatArts

func (d *Dao) CheatArts(c context.Context) (res map[int64]int, err error)

CheatArts cheat list

func (*Dao) CloseReply

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

CloseReply close article's reply.

func (*Dao) DelReadPingSet

func (d *Dao) DelReadPingSet(c context.Context, read *model.Read) (err error)

DelReadPingSet 删除阅读记录缓存

func (*Dao) DelScore

func (d *Dao) DelScore(c context.Context, aid, mediaID, mid int64) (err error)

DelScore .

func (*Dao) DelSearch

func (d *Dao) DelSearch(c context.Context, aid int64) (err error)

DelSearch del search article table

func (*Dao) DupViewIntercept

func (d *Dao) DupViewIntercept(c context.Context, aid, mid int64) (ban bool)

DupViewIntercept intercepts illegal views.

func (*Dao) ExpireSortCache

func (d *Dao) ExpireSortCache(c context.Context, categoryID int64, field int) (ok bool, err error)

ExpireSortCache expire sort cache

func (*Dao) FlowSync

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

FlowSync 流量管理同步过审文章

func (*Dao) GameList

func (d *Dao) GameList(c context.Context) (res []int64, err error)

GameList get data from cache if miss will call source method, then add to cache.

func (*Dao) GameSync

func (d *Dao) GameSync(c context.Context, action string, cvid int64) (err error)

GameSync game sync

func (*Dao) GetRecheckCache

func (d *Dao) GetRecheckCache(c context.Context, aid int64) (isRecheck bool, err error)

GetRecheckCache get recheck info from redis

func (*Dao) GetRecheckInfo

func (d *Dao) GetRecheckInfo(c context.Context, id int64) (publishTime int64, checkState int, err error)

GetRecheckInfo get article recheck

func (*Dao) Intercept

func (d *Dao) Intercept(c context.Context, aid, mid int64, ip string) (ban bool)

Intercept intercepts illegal views.

func (*Dao) IsAct

func (d *Dao) IsAct(c context.Context, id int64) (res bool)

IsAct .

func (*Dao) Keywords

func (d *Dao) Keywords(c context.Context, id int64) (keywords string, err error)

Keywords .

func (*Dao) LastModIDs

func (d *Dao) LastModIDs(c context.Context, size int) (aids []int64, err error)

LastModIDs .

func (*Dao) LikeSync

func (d *Dao) LikeSync(c context.Context, aid, likes int64) (err error)

LikeSync like sync

func (*Dao) MidsByPublishTime

func (d *Dao) MidsByPublishTime(c context.Context, pubTime int64) (mids []int64, err error)

MidsByPublishTime get mids by publish time

func (*Dao) NewestArtIDByCategory

func (d *Dao) NewestArtIDByCategory(c context.Context, cids []int64, limit int64) (res [][2]int64, err error)

NewestArtIDByCategory find newest article's id

func (*Dao) NewestArtIDs

func (d *Dao) NewestArtIDs(c context.Context, limit int64) (res [][2]int64, err error)

NewestArtIDs find newest article's id

func (*Dao) OpenReply

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

OpenReply opens article's reply.

func (*Dao) Ping

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

Ping reports the health of the db/cache etc.

func (*Dao) PopArtCache

func (d *Dao) PopArtCache(c context.Context) (bs []byte, err error)

PopArtCache .

func (*Dao) PopCDN

func (d *Dao) PopCDN(c context.Context) (file string, err error)

PopCDN .

func (*Dao) PopDynamicCache

func (d *Dao) PopDynamicCache(c context.Context) (res *model.DynamicCacheRetry, err error)

PopDynamicCache .

func (*Dao) PopFlowCache

func (d *Dao) PopFlowCache(c context.Context) (res *model.FlowCacheRetry, err error)

PopFlowCache .

func (*Dao) PopGameCache

func (d *Dao) PopGameCache(c context.Context) (res *model.GameCacheRetry, err error)

PopGameCache .

func (*Dao) PopReply

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

PopReply consume reply's job.

func (*Dao) PopStat

func (d *Dao) PopStat(c context.Context) (bs []byte, err error)

PopStat pops failed item from redis.

func (*Dao) PubDynamic

func (d *Dao) PubDynamic(c context.Context, mid int64, aid int64, show bool, comment string, ts int64, dynamicIntro string) (err error)

PubDynamic pub dynamic

func (*Dao) PurgeCDN

func (d *Dao) PurgeCDN(c context.Context, file string) (err error)

PurgeCDN purges cdn.

func (*Dao) PushArtCache

func (d *Dao) PushArtCache(c context.Context, info *CacheRetry) (err error)

PushArtCache .

func (*Dao) PushCDN

func (d *Dao) PushCDN(c context.Context, file string) (err error)

PushCDN .

func (*Dao) PushDynamicCache

func (d *Dao) PushDynamicCache(c context.Context, info *model.DynamicCacheRetry) (err error)

PushDynamicCache put dynamic to redis

func (*Dao) PushFlowCache

func (d *Dao) PushFlowCache(c context.Context, info *model.FlowCacheRetry) (err error)

PushFlowCache .

func (*Dao) PushGameCache

func (d *Dao) PushGameCache(c context.Context, info *model.GameCacheRetry) (err error)

PushGameCache .

func (*Dao) PushReply

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

PushReply opens article's reply.

func (*Dao) PushStat

func (d *Dao) PushStat(c context.Context, retry *StatRetry) (err error)

PushStat pushs failed item to redis.

func (*Dao) RawGameList

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

RawGameList game list

func (*Dao) ReadPing

func (d *Dao) ReadPing(c context.Context, buvid string, aid int64) (last int64, err error)

ReadPing 获取上次阅读心跳时间,不存在则返回0

func (*Dao) ReadPingSet

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

ReadPingSet 获取所有阅读记录(不删除)

func (*Dao) SearchArts

func (d *Dao) SearchArts(c context.Context, ptime int64) (res []*model.SearchArticle, err error)

SearchArts get articles publish time after ptime

func (*Dao) SetRecheckCache

func (d *Dao) SetRecheckCache(c context.Context, aid int64) (isRecheck bool, err error)

SetRecheckCache set recheck info to redis

func (*Dao) Settings

func (d *Dao) Settings(c context.Context) (res map[string]string, err error)

Settings gets article settings.

func (*Dao) Stat

func (d *Dao) Stat(c context.Context, aid int64) (stat *artmdl.StatMsg, err error)

Stat returns stat info.

func (*Dao) StatByMid

func (d *Dao) StatByMid(c context.Context, mid int64) (res map[int64][2]int64, err error)

StatByMid get author info by mid

func (*Dao) Update

func (d *Dao) Update(c context.Context, stat *artmdl.StatMsg) (rows int64, err error)

Update updates stat in db.

func (*Dao) UpdateRecheck

func (d *Dao) UpdateRecheck(c context.Context, aid int64) (err error)

UpdateRecheck update recheck table

func (*Dao) UpdateSearch

func (d *Dao) UpdateSearch(c context.Context, a *model.SearchArticle) (err error)

UpdateSearch update search article table

func (*Dao) UpdateSearchStats

func (d *Dao) UpdateSearchStats(c context.Context, stat *artmdl.StatMsg) (err error)

UpdateSearchStats update search stats

type StatRetry

type StatRetry struct {
	Action int             `json:"action"`
	Count  int             `json:"count"`
	Data   *artmdl.StatMsg `json:"data"`
}

StatRetry .

Jump to

Keyboard shortcuts

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