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

Documentation

Index

Constants

View Source
const (
	FilterAreaAccount = "BBQ_account"
	FilterAreaVideo   = "BBQ_video"
	FilterAreaReply   = "BBQ_reply"
	FilterAreaSearch  = "BBQ_search"
	FilterAreaDanmu   = "BBQ_danmu"
	FilterLevel       = 20
)

用于filter

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) AddLike

func (d *Dao) AddLike(c context.Context, mid, upMid, svid int64) (affectedNum int64, err error)

AddLike .

func (*Dao) AttentionRecList

func (d *Dao) AttentionRecList(ctx context.Context, size int64, mid int64, buvid string) (svIDs []int64, err error)

AttentionRecList 关注页为空时的推荐

func (*Dao) BatchUserInfo

func (d *Dao) BatchUserInfo(c context.Context, visitorMID int64, MIDs []int64, needDesc, needStat, needFollowState bool) (res map[int64]*v1.UserInfo, err error)

BatchUserInfo 提供批量获取UserInfo的方法 由于user service返回的结构和video的回包不同,因此这里进行映射,返回video-c的结构,避免外部使用方多次映射

func (*Dao) BatchVideoInfo

func (d *Dao) BatchVideoInfo(c context.Context, svids []int64) (res map[int64]*video.VideoInfo, err error)

BatchVideoInfo .

func (*Dao) BeginTran

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

BeginTran begin mysql transaction

func (*Dao) CancelLike

func (d *Dao) CancelLike(c context.Context, mid, upMid, svid int64) (affectedNum int64, err error)

CancelLike .

func (*Dao) CheckUserLike

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

CheckUserLike 检测用户是否点赞

func (*Dao) Close

func (d *Dao) Close()

Close close the resource.

func (*Dao) ConvID2SVID

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

ConvID2SVID 转换搜索相对id到svid

func (*Dao) CreateNotice

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

CreateNotice 创建通知

func (*Dao) EditUserBase

func (d *Dao) EditUserBase(c context.Context, userBase *user.UserBase) (err error)

EditUserBase .

func (*Dao) FetchAppPackage

func (d *Dao) FetchAppPackage(c context.Context) (result []*v1.AppPackage, err error)

FetchAppPackage .

func (*Dao) FetchAppResource

func (d *Dao) FetchAppResource(c context.Context, plat int, ver int) (result []*model.AppResource, err error)

FetchAppResource .

func (*Dao) FetchAvailableOutboxList

func (d *Dao) FetchAvailableOutboxList(c context.Context, fetchStates string, mids []int64, cursorNext bool, cursorSvID int64, cursorPubtime time.Time, size int) (svIDs []int64, err error)

FetchAvailableOutboxList 根据提供的up主mids去获取比lastSvID还小的svid @param CursorID 函数并不判断SvID正确性,由调用方保证 @param cursorNext 表明fetch的方向,同时会影响排序顺序

true:	则有如下条件sql"... and id < {{svid}} order by id desc..."
false:	则有如下条件sql"... and id > {{svid}} order by id asc..."

@return svIDs 注意:svid的返回有顺序

func (*Dao) FetchFollowList

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

FetchFollowList 获取mid的所有关注up主

func (*Dao) FetchNewAppVersion

func (d *Dao) FetchNewAppVersion(c context.Context, platform int, vCode int) (result *model.AppVersion, err error)

FetchNewAppVersion .

func (*Dao) Filter

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

Filter .

func (*Dao) GetList

func (d *Dao) GetList(c context.Context, pageSize int64) (result []int64, err error)

GetList 获取列表,按照db排序,按page返回,用于推荐的降级

func (*Dao) GetLocationAll

func (d *Dao) GetLocationAll(c context.Context) (*map[int32][]*model.Location, error)

GetLocationAll .

func (*Dao) GetLocationChild

func (d *Dao) GetLocationChild(c context.Context, locID int32) (*map[int32][]*model.Location, error)

GetLocationChild .

func (*Dao) GetMIDLastPubtime

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

GetMIDLastPubtime 获取该用户feed中的最新浏览svid

func (*Dao) GetNoticeUnread

func (d *Dao) GetNoticeUnread(ctx context.Context, mid int64) (list []*notice.UnreadItem, err error)

GetNoticeUnread 获取未读情况

func (*Dao) GetRandSvList

func (d *Dao) GetRandSvList(limit int) []int64

GetRandSvList .

func (*Dao) GetRandVideoList

func (d *Dao) GetRandVideoList(mid int64, limit int) []*model.SvInfo

GetRandVideoList .

func (*Dao) GetUserBProfile

func (d *Dao) GetUserBProfile(c context.Context, mid int64) (res *accountv1.ProfileReply, err error)

GetUserBProfile 获取用户全量b站信息

func (*Dao) GetUserShareToken

func (d *Dao) GetUserShareToken(ctx context.Context, mid int64) string

GetUserShareToken .

func (*Dao) GetVideoDetail

func (d *Dao) GetVideoDetail(ctx context.Context, svIDs []int64) (list []*model.SvInfo, retIDs []int64, err error)

GetVideoDetail 从数据库video中获取svid相应的信息

func (*Dao) IncrVideoStatisticsShare

func (d *Dao) IncrVideoStatisticsShare(ctx context.Context, svid int64) (num int32, err error)

IncrVideoStatisticsShare .

func (*Dao) JustGetUserBase

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

JustGetUserBase 只取UserBase,不要其他

func (*Dao) Login

func (d *Dao) Login(c context.Context, userBase *user.UserBase) (res *user.UserBase, err error)

Login .

func (*Dao) MergeUploadReq

func (d *Dao) MergeUploadReq(c context.Context, rurl string, uploadID string, profile string, svid int64, auth string) (err error)

MergeUploadReq ..

func (*Dao) ModifyRelation

func (d *Dao) ModifyRelation(c context.Context, mid, upMid int64, action int32) (res *user.ModifyRelationReply, err error)

ModifyRelation .

func (*Dao) NoticeList

func (d *Dao) NoticeList(ctx context.Context, noticeType int32, mid, cursorID int64) (list []*notice.NoticeBase, err error)

NoticeList 获取通知列表

func (*Dao) ParseRel2ID

func (d *Dao) ParseRel2ID(relID []int32) (idList []int64)

ParseRel2ID 转换搜索相对id到自增id

func (*Dao) PhoneCheck

func (d *Dao) PhoneCheck(c context.Context, mid int64) (telStatus int32, err error)

PhoneCheck .

func (*Dao) Ping

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

Ping dao ping

func (*Dao) PushCallback

func (d *Dao) PushCallback(c context.Context, tid string, nid string, mid int64, buvid string) (err error)

PushCallback .

func (*Dao) PushLogin

func (d *Dao) PushLogin(c context.Context, req *notice.UserPushDev) (err error)

PushLogin .

func (*Dao) PushLogout

func (d *Dao) PushLogout(c context.Context, req *notice.UserPushDev) (err error)

PushLogout .

func (*Dao) RawBullet

func (d *Dao) RawBullet(ctx context.Context, danmu int64) (v *model.Danmu, err error)

RawBullet ...

func (*Dao) RawPlayURLs

func (d *Dao) RawPlayURLs(c context.Context, cids []int64, qn int64, plat string) (res map[int64]*v1.CVideo, err error)

RawPlayURLs 批量获取cid playurl

func (*Dao) RawRecList

func (d *Dao) RawRecList(ctx context.Context, size int64, mid int64, buvid string) (svIDs []int64, err error)

RawRecList 获取推荐列表

func (*Dao) RawSVBvcKey

func (d *Dao) RawSVBvcKey(c context.Context, svids []int64) (res map[int64][]*model.SVBvcKey, err error)

RawSVBvcKey 批量获取playurl相对地址

func (*Dao) RawVideoStatistic

func (d *Dao) RawVideoStatistic(c context.Context, svids []int64) (res map[int64]*model.SvStInfo, err error)

RawVideoStatistic get video statistics

func (*Dao) RawVideoStatistics

func (d *Dao) RawVideoStatistics(c context.Context, svid int64) (res *model.VideoStatistics, err error)

RawVideoStatistics .

func (*Dao) RawVideos

func (d *Dao) RawVideos(ctx context.Context, svIDs []int64) (res map[int64]*model.SvInfo, err error)

RawVideos 从数据库批量获取视频信息

func (*Dao) RelPlayURLs

func (d *Dao) RelPlayURLs(c context.Context, addrs []string) (res map[string]*grpc.VideoKeyItem, err error)

RelPlayURLs 相对地址批量获取playurl

func (*Dao) RelRecList

func (d *Dao) RelRecList(ctx context.Context, req *rec.RecsysRequest) (svIDs []int64, err error)

RelRecList 相关推荐列表

func (*Dao) ReplyAdd

func (d *Dao) ReplyAdd(c context.Context, req map[string]interface{}) (res *model.AddRes, err error)

ReplyAdd http请求添加评论

func (*Dao) ReplyCounts

func (d *Dao) ReplyCounts(c context.Context, ids []int64, t int64) (res map[int64]*model.ReplyCount, err error)

ReplyCounts 批量评论数

func (*Dao) ReplyCursor

func (d *Dao) ReplyCursor(c context.Context, req map[string]interface{}) (res *model.CursorRes, err error)

ReplyCursor http请求游标获取评论

func (*Dao) ReplyHot

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

ReplyHot 获取批量热评

func (*Dao) ReplyLike

func (d *Dao) ReplyLike(c context.Context, req map[string]interface{}) (err error)

ReplyLike http请求评论点赞

func (*Dao) ReplyList

func (d *Dao) ReplyList(c context.Context, req map[string]interface{}) (res *model.ReplyList, err error)

ReplyList 评论列表

func (*Dao) ReplyMinfo

func (d *Dao) ReplyMinfo(c context.Context, svID int64, rpids []int64) (res map[int64]*model.Reply, err error)

ReplyMinfo 批量请求评论

func (*Dao) ReplyReport

func (d *Dao) ReplyReport(c context.Context, req map[string]interface{}) (err error)

ReplyReport 评论举报

func (*Dao) ReplySubCursor

func (d *Dao) ReplySubCursor(c context.Context, req map[string]interface{}) (res *model.SubCursorRes, err error)

ReplySubCursor http请求子评论游标获取评论

func (*Dao) ReportDanmu

func (d *Dao) ReportDanmu(c context.Context, danmu int64, mid int64, rmid int64, reason string) (err error)

ReportDanmu ..

func (*Dao) ReportUser

func (d *Dao) ReportUser(c context.Context, rType int, mid int64, rmid int64, reason string) (err error)

ReportUser rType=0 face;rType=1 name;

func (*Dao) ReportVideo

func (d *Dao) ReportVideo(c context.Context, svid int64, rmid int64, reason string) (err error)

ReportVideo ..

func (*Dao) SearchBBQ

func (d *Dao) SearchBBQ(c context.Context, sreq *model.SearchBaseReq) (ret *model.RawSearchRes, err error)

SearchBBQ 搜索视频

func (*Dao) SetMIDLastPubtime

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

SetMIDLastPubtime redis设置

func (*Dao) SetUserShareToken

func (d *Dao) SetUserShareToken(ctx context.Context, mid int64, token string) (int64, error)

SetUserShareToken .

func (*Dao) SugBBQ

func (d *Dao) SugBBQ(c context.Context, sreq *model.SugBaseReq) (ret json.RawMessage, err error)

SugBBQ 搜索视频

func (*Dao) SvDel

func (d *Dao) SvDel(c context.Context, in *video.VideoDeleteRequest) (interface{}, error)

SvDel 视频删除

func (*Dao) TxAddVideoStatistics

func (d *Dao) TxAddVideoStatistics(tx *sql.Tx, videoStatistics *model.VideoStatistics) (num int64, err error)

TxAddVideoStatistics .

func (*Dao) TxDecrVideoStatisticsLike

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

TxDecrVideoStatisticsLike .

func (*Dao) TxIncrVideoStatisticsLike

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

TxIncrVideoStatisticsLike .

func (*Dao) Upload

func (d *Dao) Upload(c context.Context, fileName string, filePath string, file []byte) (location string, err error)

Upload .

func (*Dao) UserLikeList

func (d *Dao) UserLikeList(c context.Context, upMid int64, cursorPrev, cursorNext string) (res *user.ListUserLikeReply, err error)

UserLikeList .

func (*Dao) UserRelationList

func (d *Dao) UserRelationList(c context.Context, userReq *user.ListRelationUserInfoReq, relationType int32) (res *v1.UserRelationListResponse, err error)

UserRelationList .

func (*Dao) VideoBase

func (d *Dao) VideoBase(c context.Context, mid, svid int64) (res *video.VideoBase, err error)

VideoBase 获取单个svid的VideoBase,不存在则会返回error

Jump to

Keyboard shortcuts

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