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

Documentation

Index

Constants

View Source
const (
	RelationLogID = 13
)

consts

Variables

This section is empty.

Functions

This section is empty.

Types

type Dao

type Dao struct {

	// followers unread duration
	UnreadDuration int64
	// 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) AddBlackLog

func (d *Dao) AddBlackLog(ctx context.Context, rl *model.RelationLog)

AddBlackLog is

func (*Dao) AddFollowingCache

func (d *Dao) AddFollowingCache(c context.Context, mid int64, following *model.Following) (err error)

AddFollowingCache add following cache.

func (*Dao) AddFollowingLog

func (d *Dao) AddFollowingLog(ctx context.Context, rl *model.RelationLog)

AddFollowingLog is

func (*Dao) AddMonitor

func (d *Dao) AddMonitor(c context.Context, mid int64, now time.Time) (affected int64, err error)

AddMonitor add mid to monitor table

func (*Dao) AddRctFollower

func (d *Dao) AddRctFollower(c context.Context, mid, fid int64) error

AddRctFollower is

func (*Dao) AddStat

func (d *Dao) AddStat(c context.Context, mid int64, stat *model.Stat, now time.Time) (affected int64, err error)

AddStat try add stat.

func (*Dao) AddTag

func (d *Dao) AddTag(c context.Context, mid, fid int64, tag string, now time.Time) (lastID int64, err error)

AddTag add tag.

func (*Dao) AddTagUser

func (d *Dao) AddTagUser(c context.Context, mid, fid int64, tag []int64, now time.Time) (affected int64, err error)

AddTagUser update tag name info.

func (*Dao) AddWhisperLog

func (d *Dao) AddWhisperLog(ctx context.Context, rl *model.RelationLog)

AddWhisperLog is

func (*Dao) BCount

func (d *Dao) BCount(c context.Context, mid, ts int64, btype int8) (count int64, err error)

BCount get business type prompt count.

func (*Dao) BeginTran

func (d *Dao) BeginTran(c context.Context) (*sql.Tx, error)

BeginTran begin transaction.

func (*Dao) Close

func (d *Dao) Close()

Close close connections of mc, redis, db.

func (*Dao) ClosePrompt

func (d *Dao) ClosePrompt(c context.Context, mid, fid, ts int64, btype int8) (err error)

ClosePrompt set prompt count to max config value.

func (*Dao) DelBlackLog

func (d *Dao) DelBlackLog(ctx context.Context, rl *model.RelationLog)

DelBlackLog is

func (*Dao) DelFollowerCache

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

DelFollowerCache delete follower cache.

func (*Dao) DelFollowerLog

func (d *Dao) DelFollowerLog(ctx context.Context, rl *model.RelationLog)

DelFollowerLog is

func (*Dao) DelFollowerNotifyCache

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

DelFollowerNotifyCache Del data from mc

func (*Dao) DelFollowing

func (d *Dao) DelFollowing(c context.Context, mid int64, following *model.Following) (err error)

DelFollowing del following cache.

func (*Dao) DelFollowingCache

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

DelFollowingCache delete following cache.

func (*Dao) DelFollowingLog

func (d *Dao) DelFollowingLog(ctx context.Context, rl *model.RelationLog)

DelFollowingLog is

func (*Dao) DelFollowingsCache

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

DelFollowingsCache delete followings cache.

func (*Dao) DelMonitor

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

DelMonitor del mid from monitor table

func (*Dao) DelMonitorCache

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

DelMonitorCache del monitor cache

func (*Dao) DelRctFollower

func (d *Dao) DelRctFollower(c context.Context, mid, fid int64) error

DelRctFollower is

func (*Dao) DelStatCache

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

DelStatCache delete stat cache.

func (*Dao) DelTag

func (d *Dao) DelTag(c context.Context, mid, id int64) (affected int64, err error)

DelTag del tag.

func (*Dao) DelTagCountCache

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

DelTagCountCache del tag count cache

func (*Dao) DelTagsCache

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

DelTagsCache del user tags cache.

func (*Dao) DelWhisperLog

func (d *Dao) DelWhisperLog(ctx context.Context, rl *model.RelationLog)

DelWhisperLog is

func (*Dao) DisableFollowerNotify

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

DisableFollowerNotify disable follower-notify setting

func (*Dao) EmptyRctFollower

func (d *Dao) EmptyRctFollower(ctx context.Context, fid int64) error

EmptyRctFollower is

func (*Dao) EnableFollowerNotify

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

EnableFollowerNotify enable follower-notify setting

func (*Dao) FollowerCache

func (d *Dao) FollowerCache(c context.Context, mid int64) (followers []*model.Following, err error)

FollowerCache get follower cache.

func (*Dao) FollowerNotifySetting

func (d *Dao) FollowerNotifySetting(c context.Context, mid int64) (bool, error)

FollowerNotifySetting get follower-notify setting 这里返回用户通知开关的状态(和数据库存储的状态值相反)

func (*Dao) Followers

func (d *Dao) Followers(c context.Context, mid int64) (res []*model.Following, err error)

Followers get user's latest 1000 followers(attribute = AttrFollowing), order by mtime desc.

func (*Dao) FollowingCache

func (d *Dao) FollowingCache(c context.Context, mid int64) (followings []*model.Following, err error)

FollowingCache get following cache.

func (*Dao) Followings

func (d *Dao) Followings(c context.Context, mid int64) (res []*model.Following, err error)

Followings get user's following list.

func (*Dao) FollowingsCache

func (d *Dao) FollowingsCache(c context.Context, mid int64) (followings []*model.Following, err error)

FollowingsCache get followings cache.

func (*Dao) FollowingsIn

func (d *Dao) FollowingsIn(c context.Context, mid int64, fids []int64) (res []*model.Following, err error)

FollowingsIn get user's following list by in fids

func (*Dao) GetFollowerNotifyCache

func (d *Dao) GetFollowerNotifyCache(c context.Context, mid int64) (res *model.FollowerNotifySetting, err error)

GetFollowerNotifyCache get data from mc

func (*Dao) GlobalHotRecCache

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

GlobalHotRecCache get global hot recommend.

func (*Dao) HasReachAchieve

func (d *Dao) HasReachAchieve(c context.Context, mid int64, achieve model.AchieveFlag) bool

HasReachAchieve is

func (*Dao) IncrPromptCount

func (d *Dao) IncrPromptCount(c context.Context, mid, fid, ts int64, btype int8) (ucount, bcount int64, err error)

IncrPromptCount incr up prompt count and business type prompt count.

func (*Dao) IncrTodayNotifyCount

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

IncrTodayNotifyCount increment the today notify count in the current day

func (*Dao) LoadMonitor

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

LoadMonitor load all mids into redis set.

func (*Dao) LoadMonitorCache

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

LoadMonitorCache load monitor cache

func (*Dao) MonitorCache

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

MonitorCache monitor cache

func (*Dao) PassportDetail

func (d *Dao) PassportDetail(c context.Context, mid int64, ip string) (res *model.PassportDetail, err error)

PassportDetail get passport detail from passport service through http

func (*Dao) Ping

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

Ping ping health.

func (*Dao) RctFollowerCount

func (d *Dao) RctFollowerCount(ctx context.Context, fid int64) (int64, error)

RctFollowerCount is

func (*Dao) RctFollowerNotify

func (d *Dao) RctFollowerNotify(c context.Context, fid int64) (bool, error)

RctFollowerNotify is

func (*Dao) Relation

func (d *Dao) Relation(c context.Context, mid, fid int64) (attr uint32, err error)

Relation get relation between mid and fid.

func (*Dao) RelationsCache

func (d *Dao) RelationsCache(c context.Context, mid int64, fids []int64) (resMap map[int64]*model.Following, err error)

RelationsCache relations cache.

func (*Dao) SetFollowerCache

func (d *Dao) SetFollowerCache(c context.Context, mid int64, followers []*model.Following) (err error)

SetFollowerCache set follower cache.

func (*Dao) SetFollowerNotifyCache

func (d *Dao) SetFollowerNotifyCache(c context.Context, mid int64, val *model.FollowerNotifySetting) (err error)

SetFollowerNotifyCache Set data to mc

func (*Dao) SetFollowingCache

func (d *Dao) SetFollowingCache(c context.Context, mid int64, followings []*model.Following) (err error)

SetFollowingCache set following cache.

func (*Dao) SetFollowingsCache

func (d *Dao) SetFollowingsCache(c context.Context, mid int64, followings []*model.Following) (err error)

SetFollowingsCache set followings cache.

func (*Dao) SetGlobalHotRecCache

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

SetGlobalHotRecCache set global hot recommend cache.

func (*Dao) SetMonitorCache

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

SetMonitorCache set monitor cache

func (*Dao) SetRctFollowerNotify

func (d *Dao) SetRctFollowerNotify(c context.Context, fid int64, flag bool) error

SetRctFollowerNotify is

func (*Dao) SetStatCache

func (d *Dao) SetStatCache(c context.Context, mid int64, st *model.Stat) error

SetStatCache set stat cache.

func (*Dao) SetTagCountCache

func (d *Dao) SetTagCountCache(c context.Context, mid int64, tagCount []*model.TagCount) (err error)

SetTagCountCache set tag count cache

func (*Dao) SetTagName

func (d *Dao) SetTagName(c context.Context, id, mid int64, name string, now time.Time) (affected int64, err error)

SetTagName update tag name info.

func (*Dao) SetTagUser

func (d *Dao) SetTagUser(c context.Context, mid, fid int64, tag i64b.Int64Bytes, now time.Time) (affected int64, err error)

SetTagUser setTagUser info.

func (*Dao) SetTagsCache

func (d *Dao) SetTagsCache(c context.Context, mid int64, tags *model.Tags) (err error)

SetTagsCache set user tags cache.

func (*Dao) Stat

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

Stat get stat.

func (*Dao) StatCache

func (d *Dao) StatCache(c context.Context, mid int64) (*model.Stat, error)

StatCache get stat cache.

func (*Dao) StatsCache

func (d *Dao) StatsCache(c context.Context, mids []int64) (map[int64]*model.Stat, []int64, error)

StatsCache get multi stat cache.

func (*Dao) TagCountCache

func (d *Dao) TagCountCache(c context.Context, mid int64) (tagCount []*model.TagCount, err error)

TagCountCache tag count cache

func (*Dao) TagUserByMidFid

func (d *Dao) TagUserByMidFid(c context.Context, mid, fid int64) (tag *model.TagUser, err error)

TagUserByMidFid get tagIds by mid and fid.

func (*Dao) Tags

func (d *Dao) Tags(c context.Context, mid int64) (res map[int64]*model.Tag, err error)

Tags get tags list.

func (*Dao) TagsCache

func (d *Dao) TagsCache(c context.Context, mid int64) (tags map[int64]*model.Tag, err error)

TagsCache get user tags.

func (*Dao) TodayNotifyCountCache

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

TodayNotifyCountCache get notify count in the current day

func (*Dao) TxAddFollower

func (d *Dao) TxAddFollower(c context.Context, tx *sql.Tx, mid, fid int64, mask uint32, source uint8, now time.Time) (affected int64, err error)

TxAddFollower add follower by transaction.

func (*Dao) TxAddFollowing

func (d *Dao) TxAddFollowing(c context.Context, tx *sql.Tx, mid, fid int64, mask uint32, source uint8, now time.Time) (affected int64, err error)

TxAddFollowing add following by transaction.

func (*Dao) TxAddStat

func (d *Dao) TxAddStat(c context.Context, tx *sql.Tx, mid int64, stat *model.Stat, now time.Time) (affected int64, err error)

TxAddStat add params stat to stat by transaction.

func (*Dao) TxDelTagUser

func (d *Dao) TxDelTagUser(c context.Context, tx *sql.Tx, mid, fid int64) (affected int64, err error)

TxDelTagUser delete tag user record.

func (*Dao) TxSetFollower

func (d *Dao) TxSetFollower(c context.Context, tx *sql.Tx, mid, fid int64, attribute uint32, source uint8, status int, now time.Time) (affected int64, err error)

TxSetFollower set follower by transaction.

func (*Dao) TxSetFollowing

func (d *Dao) TxSetFollowing(c context.Context, tx *sql.Tx, mid, fid int64, attribute uint32, source uint8, status int, now time.Time) (affected int64, err error)

TxSetFollowing set following by transaction.

func (*Dao) TxSetStat

func (d *Dao) TxSetStat(c context.Context, tx *sql.Tx, mid int64, stat *model.Stat, now time.Time) (affected int64, err error)

TxSetStat set stat to params stat by transaction.

func (*Dao) TxStat

func (d *Dao) TxStat(c context.Context, tx *sql.Tx, mid int64) (stat *model.Stat, err error)

TxStat get stat for update by transaction.

func (*Dao) UpCount

func (d *Dao) UpCount(c context.Context, mid, fid, ts int64) (count int64, err error)

UpCount get upper prompt count.

func (*Dao) UserTag

func (d *Dao) UserTag(c context.Context, mid int64) (tags map[int64][]int64, err error)

UserTag user tag

func (*Dao) UsersTags

func (d *Dao) UsersTags(c context.Context, mid int64, fid []int64) (tags map[int64]*model.TagUser, err error)

UsersTags users tag by fids.

Jump to

Keyboard shortcuts

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