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: 26 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) AddCacheUserBase

func (d *Dao) AddCacheUserBase(c context.Context, userBases map[int64]*api.UserBase) (err error)

AddCacheUserBase 添加用户缓存

func (*Dao) AddUserBase

func (d *Dao) AddUserBase(c context.Context, userBase *api.UserBase) (num int64, err error)

AddUserBase .

func (*Dao) BeginTran

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

BeginTran begin mysql transaction

func (*Dao) CacheUserBase

func (d *Dao) CacheUserBase(c context.Context, mids []int64) (res map[int64]*api.UserBase, err error)

CacheUserBase multi get user base from cache.

func (*Dao) CheckUname

func (d *Dao) CheckUname(c context.Context, mid int64, uname string) (err error)

CheckUname 检测昵称

func (*Dao) CheckUserLike

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

CheckUserLike 检测用户是否点赞

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) CreateNotice

func (d *Dao) CreateNotice(ctx context.Context, notice *notice.NoticeBase) (err error)

CreateNotice 创建通知

func (*Dao) DelCacheUserBase

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

DelCacheUserBase 删除用户缓存

func (*Dao) FetchBlackList

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

FetchBlackList 获取mid的所有拉黑up主

func (*Dao) FetchFollowList

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

FetchFollowList 获取mid的所有关注up主

func (*Dao) FetchPartBlackList

func (d *Dao) FetchPartBlackList(c context.Context, mid int64, cursor model.CursorValue, size int) (
	MID2IDMap map[int64]time.Time, blackMIDs []int64, err error)

FetchPartBlackList 获取mid的拉黑up主

func (*Dao) FetchPartFanList

func (d *Dao) FetchPartFanList(c context.Context, mid int64, cursor model.CursorValue, size int) (
	MID2IDMap map[int64]time.Time, followedMIDs []int64, err error)

FetchPartFanList 获取mid的粉丝列表

func (*Dao) FetchPartFollowList

func (d *Dao) FetchPartFollowList(c context.Context, mid int64, cursor model.CursorValue, size int) (
	MID2IDMap map[int64]time.Time, followedMIDs []int64, err error)

FetchPartFollowList 获取mid的关注up主

cursor_id代表相应的up_mid,cursor_time表示mtime

func (*Dao) Filter

func (d *Dao) Filter(ctx context.Context, content string, area string) (level int32, err error)

Filter .

func (*Dao) ForbidUser

func (d *Dao) ForbidUser(c context.Context, mid uint64, exTime uint64) (err error)

ForbidUser .

func (*Dao) GetLocation

func (d *Dao) GetLocation(c context.Context, locId int32) (*api.LocationItem, error)

GetLocation return the location info

func (*Dao) GetUserBProfile

func (d *Dao) GetUserBProfile(c context.Context, in *api.PhoneCheckReq) (res *accountv1.ProfileReply, err error)

GetUserBProfile 获取用户全量b站信息

func (*Dao) GetUserLikeList

func (d *Dao) GetUserLikeList(c context.Context, mid int64, cursorNext bool, cursor model.CursorValue, size int) (
	likeSvs []*api.LikeSv, err error)

GetUserLikeList 返回用户点赞列表

当前cursorID表示opid

func (*Dao) IsBlack

func (d *Dao) IsBlack(c context.Context, mid int64, candidateMIDs []int64) (MIDMap map[int64]bool)

IsBlack 获取mid的拉黑用户

func (*Dao) IsFan

func (d *Dao) IsFan(c context.Context, mid int64, candidateMIDs []int64) (MIDMap map[int64]bool)

IsFan 获取mid的粉丝

func (*Dao) IsFollow

func (d *Dao) IsFollow(c context.Context, mid int64, candidateMIDs []int64) (MIDMap map[int64]bool)

IsFollow 获取mid的关注up主

func (*Dao) MockAddCacheUserBase

func (d *Dao) MockAddCacheUserBase(err error) (guard *monkey.PatchGuard)

MockAddCacheUserBase .

func (*Dao) MockAddUserBase

func (d *Dao) MockAddUserBase(num int64, err error) (guard *monkey.PatchGuard)

MockAddUserBase .

func (*Dao) MockBeginTran

func (d *Dao) MockBeginTran(p1 *xsql.Tx, err error) (guard *monkey.PatchGuard)

MockBeginTran .

func (*Dao) MockCacheUserBase

func (d *Dao) MockCacheUserBase(res map[int64]*api.UserBase, err error) (guard *monkey.PatchGuard)

MockCacheUserBase .

func (*Dao) MockCheckUname

func (d *Dao) MockCheckUname(err error) (guard *monkey.PatchGuard)

MockCheckUname .

func (*Dao) MockCheckUserLike

func (d *Dao) MockCheckUserLike(res []int64, err error) (guard *monkey.PatchGuard)

MockCheckUserLike .

func (*Dao) MockCreateNotice

func (d *Dao) MockCreateNotice(err error) (guard *monkey.PatchGuard)

MockCreateNotice .

func (*Dao) MockFetchBlackList

func (d *Dao) MockFetchBlackList(upMid []int64, err error) (guard *monkey.PatchGuard)

MockFetchBlackList .

func (*Dao) MockFetchFollowList

func (d *Dao) MockFetchFollowList(upMid []int64, err error) (guard *monkey.PatchGuard)

MockFetchFollowList .

func (*Dao) MockFetchPartBlackList

func (d *Dao) MockFetchPartBlackList(MID2IDMap map[int64]time.Time, blackMIDs []int64, err error) (guard *monkey.PatchGuard)

MockFetchPartBlackList .

func (*Dao) MockFetchPartFanList

func (d *Dao) MockFetchPartFanList(MID2IDMap map[int64]time.Time, followedMIDs []int64, err error) (guard *monkey.PatchGuard)

MockFetchPartFanList .

func (*Dao) MockFetchPartFollowList

func (d *Dao) MockFetchPartFollowList(MID2IDMap map[int64]time.Time, followedMIDs []int64, err error) (guard *monkey.PatchGuard)

MockFetchPartFollowList .

func (*Dao) MockFilter

func (d *Dao) MockFilter(level int32, err error) (guard *monkey.PatchGuard)

MockFilter .

func (*Dao) MockForbidUser

func (d *Dao) MockForbidUser(err error) (guard *monkey.PatchGuard)

MockForbidUser .

func (*Dao) MockGetLocation

func (d *Dao) MockGetLocation(p1 *api.LocationItem, err error) (guard *monkey.PatchGuard)

MockGetLocation .

func (*Dao) MockGetUserBProfile

func (d *Dao) MockGetUserBProfile(res *acc.ProfileReply, err error) (guard *monkey.PatchGuard)

MockGetUserBProfile .

func (*Dao) MockGetUserLikeList

func (d *Dao) MockGetUserLikeList(likeSvs []*api.LikeSv, err error) (guard *monkey.PatchGuard)

MockGetUserLikeList .

func (*Dao) MockIsBlack

func (d *Dao) MockIsBlack(MIDMap map[int64]bool) (guard *monkey.PatchGuard)

MockIsBlack .

func (*Dao) MockIsFan

func (d *Dao) MockIsFan(MIDMap map[int64]bool) (guard *monkey.PatchGuard)

MockIsFan .

func (*Dao) MockIsFollow

func (d *Dao) MockIsFollow(MIDMap map[int64]bool) (guard *monkey.PatchGuard)

MockIsFollow .

func (*Dao) MockPing

func (d *Dao) MockPing(err error) (guard *monkey.PatchGuard)

MockPing .

func (*Dao) MockRawBatchUserStatistics

func (d *Dao) MockRawBatchUserStatistics(res map[int64]*api.UserStat, err error) (guard *monkey.PatchGuard)

MockRawBatchUserStatistics .

func (*Dao) MockRawUserAccCards

func (d *Dao) MockRawUserAccCards(res *acc.CardsReply, err error) (guard *monkey.PatchGuard)

MockRawUserAccCards .

func (*Dao) MockRawUserBase

func (d *Dao) MockRawUserBase(res map[int64]*api.UserBase, err error) (guard *monkey.PatchGuard)

MockRawUserBase .

func (*Dao) MockRawUserCard

func (d *Dao) MockRawUserCard(userCard *model.UserCard, err error) (guard *monkey.PatchGuard)

MockRawUserCard .

func (*Dao) MockRawUserCards

func (d *Dao) MockRawUserCards(userCards map[int64]*model.UserCard, err error) (guard *monkey.PatchGuard)

MockRawUserCards .

func (*Dao) MockReleaseUser

func (d *Dao) MockReleaseUser(err error) (guard *monkey.PatchGuard)

MockReleaseUser .

func (*Dao) MockTxAddUserBlack

func (d *Dao) MockTxAddUserBlack(num int64, err error) (guard *monkey.PatchGuard)

MockTxAddUserBlack .

func (*Dao) MockTxAddUserFan

func (d *Dao) MockTxAddUserFan(num int64, err error) (guard *monkey.PatchGuard)

MockTxAddUserFan .

func (*Dao) MockTxAddUserFollow

func (d *Dao) MockTxAddUserFollow(num int64, err error) (guard *monkey.PatchGuard)

MockTxAddUserFollow .

func (*Dao) MockTxAddUserLike

func (d *Dao) MockTxAddUserLike(num int64, err error) (guard *monkey.PatchGuard)

MockTxAddUserLike .

func (*Dao) MockTxCancelUserBlack

func (d *Dao) MockTxCancelUserBlack(num int64, err error) (guard *monkey.PatchGuard)

MockTxCancelUserBlack .

func (*Dao) MockTxCancelUserFan

func (d *Dao) MockTxCancelUserFan(num int64, err error) (guard *monkey.PatchGuard)

MockTxCancelUserFan .

func (*Dao) MockTxCancelUserFollow

func (d *Dao) MockTxCancelUserFollow(num int64, err error) (guard *monkey.PatchGuard)

MockTxCancelUserFollow .

func (*Dao) MockTxCancelUserLike

func (d *Dao) MockTxCancelUserLike(num int64, err error) (guard *monkey.PatchGuard)

MockTxCancelUserLike .

func (*Dao) MockTxDecrUserStatisticsFan

func (d *Dao) MockTxDecrUserStatisticsFan(num int64, err error) (guard *monkey.PatchGuard)

MockTxDecrUserStatisticsFan .

func (*Dao) MockTxDecrUserStatisticsFollow

func (d *Dao) MockTxDecrUserStatisticsFollow(num int64, err error) (guard *monkey.PatchGuard)

MockTxDecrUserStatisticsFollow .

func (*Dao) MockTxDescUserStatisticsField

func (d *Dao) MockTxDescUserStatisticsField(rowsAffected int64, err error) (guard *monkey.PatchGuard)

MockTxDescUserStatisticsField .

func (*Dao) MockTxIncrUserStatisticsFan

func (d *Dao) MockTxIncrUserStatisticsFan(num int64, err error) (guard *monkey.PatchGuard)

MockTxIncrUserStatisticsFan .

func (*Dao) MockTxIncrUserStatisticsField

func (d *Dao) MockTxIncrUserStatisticsField(rowsAffected int64, err error) (guard *monkey.PatchGuard)

MockTxIncrUserStatisticsField .

func (*Dao) MockTxIncrUserStatisticsFollow

func (d *Dao) MockTxIncrUserStatisticsFollow(num int64, err error) (guard *monkey.PatchGuard)

MockTxIncrUserStatisticsFollow .

func (*Dao) MockUpdateUserBase

func (d *Dao) MockUpdateUserBase(num int64, err error) (guard *monkey.PatchGuard)

MockUpdateUserBase .

func (*Dao) MockUpdateUserBaseUname

func (d *Dao) MockUpdateUserBaseUname(num int64, err error) (guard *monkey.PatchGuard)

MockUpdateUserBaseUname .

func (*Dao) MockUpdateUserField

func (d *Dao) MockUpdateUserField(num int64, err error) (guard *monkey.PatchGuard)

MockUpdateUserField .

func (*Dao) MockUpdateUserVideoView

func (d *Dao) MockUpdateUserVideoView(err error) (guard *monkey.PatchGuard)

MockUpdateUserVideoView .

func (*Dao) MockUserBase

func (d *Dao) MockUserBase(res map[int64]*api.UserBase, err error) (guard *monkey.PatchGuard)

MockUserBase .

func (*Dao) Ping

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

Ping dao ping

func (*Dao) RawBatchUserStatistics

func (d *Dao) RawBatchUserStatistics(c context.Context, mids []int64) (res map[int64]*api.UserStat, err error)

RawBatchUserStatistics 从数据库获取用户基础信息

func (*Dao) RawUserAccCards

func (d *Dao) RawUserAccCards(c context.Context, mids []int64) (res *acc.CardsReply, err error)

RawUserAccCards 批量获取账号信息

func (*Dao) RawUserBase

func (d *Dao) RawUserBase(c context.Context, mids []int64) (res map[int64]*api.UserBase, err error)

RawUserBase 从数据库获取用户基础信息

func (*Dao) RawUserCard

func (d *Dao) RawUserCard(c context.Context, mid int64) (userCard *model.UserCard, err error)

RawUserCard 从主站获取用户基础信息

func (*Dao) RawUserCards

func (d *Dao) RawUserCards(c context.Context, mids []int64) (userCards map[int64]*model.UserCard, err error)

RawUserCards 从主站获取用户基础信息

func (*Dao) ReleaseUser

func (d *Dao) ReleaseUser(c context.Context, mid uint64) (err error)

ReleaseUser ..

func (*Dao) TxAddUserBlack

func (d *Dao) TxAddUserBlack(c context.Context, tx *sql.Tx, mid, upMid int64) (num int64, err error)

TxAddUserBlack .

func (*Dao) TxAddUserFan

func (d *Dao) TxAddUserFan(tx *sql.Tx, mid, fanMid int64) (num int64, err error)

TxAddUserFan .

func (*Dao) TxAddUserFollow

func (d *Dao) TxAddUserFollow(c context.Context, tx *sql.Tx, mid, upMid int64) (num int64, err error)

TxAddUserFollow .

func (*Dao) TxAddUserLike

func (d *Dao) TxAddUserLike(tx *sql.Tx, mid, svid int64) (num int64, err error)

TxAddUserLike .

func (*Dao) TxCancelUserBlack

func (d *Dao) TxCancelUserBlack(c context.Context, tx *sql.Tx, mid, upMid int64) (num int64, err error)

TxCancelUserBlack .

func (*Dao) TxCancelUserFan

func (d *Dao) TxCancelUserFan(tx *sql.Tx, mid, fanMid int64) (num int64, err error)

TxCancelUserFan .

func (*Dao) TxCancelUserFollow

func (d *Dao) TxCancelUserFollow(c context.Context, tx *sql.Tx, mid, upMid int64) (num int64, err error)

TxCancelUserFollow .

func (*Dao) TxCancelUserLike

func (d *Dao) TxCancelUserLike(tx *sql.Tx, mid, svid int64) (num int64, err error)

TxCancelUserLike .

func (*Dao) TxDecrUserStatisticsFan

func (d *Dao) TxDecrUserStatisticsFan(tx *sql.Tx, mid int64) (num int64, err error)

TxDecrUserStatisticsFan .

func (*Dao) TxDecrUserStatisticsFollow

func (d *Dao) TxDecrUserStatisticsFollow(tx *sql.Tx, mid int64) (num int64, err error)

TxDecrUserStatisticsFollow .

func (*Dao) TxDescUserStatisticsField

func (d *Dao) TxDescUserStatisticsField(c context.Context, tx *sql.Tx, mid int64, field string) (rowsAffected int64, err error)

TxDescUserStatisticsField .

func (*Dao) TxIncrUserStatisticsFan

func (d *Dao) TxIncrUserStatisticsFan(tx *sql.Tx, mid int64) (num int64, err error)

TxIncrUserStatisticsFan .

func (*Dao) TxIncrUserStatisticsField

func (d *Dao) TxIncrUserStatisticsField(c context.Context, tx *sql.Tx, mid int64, field string) (rowsAffected int64, err error)

TxIncrUserStatisticsField .

func (*Dao) TxIncrUserStatisticsFollow

func (d *Dao) TxIncrUserStatisticsFollow(tx *sql.Tx, mid int64) (num int64, err error)

TxIncrUserStatisticsFollow .

func (*Dao) UpdateUserBase

func (d *Dao) UpdateUserBase(c context.Context, mid int64, userBase *api.UserBase) (num int64, err error)

UpdateUserBase 更新用户基础信息

func (*Dao) UpdateUserBaseUname

func (d *Dao) UpdateUserBaseUname(c context.Context, mid int64, uname string) (num int64, err error)

UpdateUserBaseUname .

func (*Dao) UpdateUserField

func (d *Dao) UpdateUserField(c context.Context, tx *sql.Tx, mid int64, field string, f interface{}) (num int64, err error)

UpdateUserField .

func (*Dao) UpdateUserVideoView

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

UpdateUserVideoView .

func (*Dao) UserBase

func (d *Dao) UserBase(c context.Context, keys []int64) (res map[int64]*api.UserBase, err error)

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

Jump to

Keyboard shortcuts

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