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: 23 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 struct

func New

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

New new a dao.

func (*Dao) AddDMCache

func (d *Dao) AddDMCache(c context.Context, dm *model.DM) (err error)

AddDMCache add dm to redis.

func (*Dao) AddDMIDCache

func (d *Dao) AddDMIDCache(c context.Context, tp int32, oid, cnt, n int64, dmids ...int64) (err error)

AddDMIDCache add dmid(normal and special) to segment redis.

func (*Dao) AddDMIDSubtitleCache

func (d *Dao) AddDMIDSubtitleCache(c context.Context, tp int32, oid int64, dms ...*model.DM) (err error)

AddDMIDSubtitleCache add subtitle dmid to redis.

func (*Dao) AddIdxContentCaches

func (d *Dao) AddIdxContentCaches(c context.Context, tp int32, oid int64, dms ...*model.DM) (err error)

AddIdxContentCaches add index content cache to redis.

func (*Dao) AddRecentDM

func (d *Dao) AddRecentDM(c context.Context, mid int64, dm *model.DM) (count int64, err error)

AddRecentDM add recent dm of up to redis.

func (*Dao) AddSpecialDmCache

func (d *Dao) AddSpecialDmCache(c context.Context, ds *model.DmSpecial) (err error)

AddSpecialDmCache add special content to memcache.

func (*Dao) AddSubject

func (d *Dao) AddSubject(c context.Context, tp int32, oid, pid, mid, maxlimit int64, attr int32) (lastID int64, err error)

AddSubject insert subject.

func (*Dao) AddSubjectCache

func (d *Dao) AddSubjectCache(c context.Context, sub *model.Subject) (err error)

AddSubjectCache add subject cache.

func (*Dao) AddTransferLock

func (d *Dao) AddTransferLock(c context.Context) (succeed bool)

AddTransferLock 添加弹幕转移并发锁

func (*Dao) AddXMLCache

func (d *Dao) AddXMLCache(c context.Context, oid int64, value []byte) (err error)

AddXMLCache add xml content to memcache.

func (*Dao) BeginBiliDMTran

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

BeginBiliDMTran .

func (*Dao) BeginTran

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

BeginTran begin mysql transaction

func (*Dao) BfsData

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

BfsData get bfs data

func (*Dao) BfsDmUpload

func (d *Dao) BfsDmUpload(c context.Context, fileName string, bs []byte) (location string, err error)

BfsDmUpload .

func (*Dao) BnjConfig

func (d *Dao) BnjConfig(c context.Context) (bnjConfig *model.BnjLiveConfig, err error)

BnjConfig .

func (*Dao) Content

func (d *Dao) Content(c context.Context, oid, dmid int64) (ct *model.Content, err error)

Content dm content by dmid

func (*Dao) ContentSpecial

func (d *Dao) ContentSpecial(c context.Context, dmid int64) (contentSpe *model.ContentSpecial, err error)

ContentSpecial get special dm content by dmids.

func (*Dao) Contents

func (d *Dao) Contents(c context.Context, oid int64, dmids []int64) (ctsMap map[int64]*model.Content, err error)

Contents multi get dm content by dmids.

func (*Dao) ContentsSpecial

func (d *Dao) ContentsSpecial(c context.Context, dmids []int64) (res map[int64]*model.ContentSpecial, err error)

ContentsSpecial multi get special dm content by dmids.

func (*Dao) DMCache

func (d *Dao) DMCache(c context.Context, tp int32, oid int64) (res [][]byte, err error)

DMCache 获取redis列表中的弹幕.

func (*Dao) DMIDCache

func (d *Dao) DMIDCache(c context.Context, tp int32, oid int64, cnt, n, limit int64) (dmids []int64, err error)

DMIDCache return dm ids.

func (*Dao) DMIDSubtitleCache

func (d *Dao) DMIDSubtitleCache(c context.Context, tp int32, oid int64, ps, pe, limit int64) (dmids []int64, err error)

DMIDSubtitleCache get subtitle dmid.

func (*Dao) DMIndexs

func (d *Dao) DMIndexs(c context.Context, tp int32, oid, minID, limit int64) (idxMap map[int64]*model.DM, dmids, special []int64, err error)

DMIndexs get dm indexs info

func (*Dao) DMSegCache

func (d *Dao) DMSegCache(c context.Context, tp int32, oid, total, num int64) (dmSeg *model.DMSeg, err error)

DMSegCache dm segment pb cache.

func (*Dao) DMSpecialLocations

func (d *Dao) DMSpecialLocations(c context.Context, tp int32, oid int64) (locations []string, err error)

DMSpecialLocations .

func (*Dao) DelAjaxDMCache

func (d *Dao) DelAjaxDMCache(c context.Context, oid int64) (err error)

DelAjaxDMCache delete ajax dm from memcache.

func (*Dao) DelDMCache

func (d *Dao) DelDMCache(c context.Context, tp int32, oid int64) (err error)

DelDMCache delete redis cache of oid.

func (*Dao) DelDMHideState

func (d *Dao) DelDMHideState(c context.Context, tp int32, oid int64, dmid int64) (affect int64, err error)

DelDMHideState del dm hide state

func (*Dao) DelDMIDCache

func (d *Dao) DelDMIDCache(c context.Context, tp int32, oid, cnt, n int64) (err error)

DelDMIDCache delete dm segment cache.

func (*Dao) DelDMIDSubtitleCache

func (d *Dao) DelDMIDSubtitleCache(c context.Context, tp int32, oid int64) (err error)

DelDMIDSubtitleCache delete subtitle dmid cache.

func (*Dao) DelDMs

func (d *Dao) DelDMs(c context.Context, oid int64, dmids []int64, state int32) (affected int64, err error)

DelDMs dm task del dms.

func (*Dao) DelIdxContentCaches

func (d *Dao) DelIdxContentCaches(c context.Context, tp int32, oid int64, dmids ...int64) (err error)

DelIdxContentCaches del index content cache.

func (*Dao) DelMaskJob

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

DelMaskJob .

func (*Dao) DelSpecialDmCache

func (d *Dao) DelSpecialDmCache(c context.Context, oid int64, tp int32) (err error)

DelSpecialDmCache .

func (*Dao) DelSubjectCache

func (d *Dao) DelSubjectCache(c context.Context, tp int32, oid int64) (err error)

DelSubjectCache delete subject memcache cache.

func (*Dao) DelSubtitleCache

func (d *Dao) DelSubtitleCache(c context.Context, oid int64, subtitleID int64) (err error)

DelSubtitleCache .

func (*Dao) DelSubtitleDraftCache

func (d *Dao) DelSubtitleDraftCache(c context.Context, oid int64, tp int32, mid int64, lan uint8) (err error)

DelSubtitleDraftCache .

func (*Dao) DelTaskJob

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

DelTaskJob .

func (*Dao) DelTransferLock

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

DelTransferLock 删除弹幕转移并发锁

func (*Dao) DelVideoSubtitleCache

func (d *Dao) DelVideoSubtitleCache(c context.Context, oid int64, tp int32) (err error)

DelVideoSubtitleCache .

func (*Dao) DelXMLCache

func (d *Dao) DelXMLCache(c context.Context, oid int64) (err error)

DelXMLCache delete xml content.

func (*Dao) DelXMLSegCache

func (d *Dao) DelXMLSegCache(c context.Context, tp int32, oid, cnt, num int64) (err error)

DelXMLSegCache delete segment xml content.

func (*Dao) DurationCache

func (d *Dao) DurationCache(c context.Context, oid int64) (duration int64, err error)

DurationCache return duration of video.

func (*Dao) ExpireDMCache

func (d *Dao) ExpireDMCache(c context.Context, tp int32, oid int64) (ok bool, err error)

ExpireDMCache expire dm.

func (*Dao) ExpireDMID

func (d *Dao) ExpireDMID(c context.Context, tp int32, oid, cnt, n int64) (ok bool, err error)

ExpireDMID set expire time of index.

func (*Dao) ExpireDMIDSubtitle

func (d *Dao) ExpireDMIDSubtitle(c context.Context, tp int32, oid int64) (ok bool, err error)

ExpireDMIDSubtitle set expire time of subtitle dmid.

func (*Dao) GenerateMask

func (d *Dao) GenerateMask(c context.Context, cid, mid int64, plat int8, priority int32, aid int64, duration int64, typeID int32) (err error)

GenerateMask ask AI to generate dm mask

func (*Dao) GetMaskJob

func (d *Dao) GetMaskJob(c context.Context) (value string, err error)

GetMaskJob .

func (*Dao) GetSetMaskJob

func (d *Dao) GetSetMaskJob(c context.Context, value string) (old string, err error)

GetSetMaskJob .

func (*Dao) GetSetTaskJob

func (d *Dao) GetSetTaskJob(c context.Context, value string) (old string, err error)

GetSetTaskJob .

func (*Dao) GetSubtitle

func (d *Dao) GetSubtitle(c context.Context, oid int64, subtitleID int64) (subtitle *model.Subtitle, err error)

GetSubtitle .

func (*Dao) GetSubtitles

func (d *Dao) GetSubtitles(c context.Context, tp int32, oid int64) (subtitles []*model.Subtitle, err error)

GetSubtitles .

func (*Dao) GetTaskJob

func (d *Dao) GetTaskJob(c context.Context) (value string, err error)

GetTaskJob .

func (*Dao) IdxContentCache

func (d *Dao) IdxContentCache(c context.Context, tp int32, oid int64, dmids []int64) (res []byte, missed []int64, err error)

IdxContentCache get xml info by dmid.

func (*Dao) IdxContentCacheV2

func (d *Dao) IdxContentCacheV2(c context.Context, tp int32, oid int64, dmids []int64) (elems []*model.Elem, missed []int64, err error)

IdxContentCacheV2 get elems info by dmid.

func (*Dao) Indexs

func (d *Dao) Indexs(c context.Context, tp int32, oid int64) (idxMap map[int64]*model.DM, dmids, special []int64, err error)

Indexs get dm index by type and oid.

func (*Dao) IndexsByPool

func (d *Dao) IndexsByPool(c context.Context, tp int32, oid int64, pool int32) (dms []*model.DM, dmids []int64, err error)

IndexsByPool get dm index by type,oid and pool.

func (*Dao) IndexsByid

func (d *Dao) IndexsByid(c context.Context, tp int32, oid int64, dmids []int64) (idxMap map[int64]*model.DM, special []int64, err error)

IndexsByid get dm index by dmids.

func (*Dao) IndexsID

func (d *Dao) IndexsID(c context.Context, tp int32, oid int64, pool int32) (dmids []int64, err error)

IndexsID get dmids.

func (*Dao) IndexsSeg

func (d *Dao) IndexsSeg(c context.Context, tp int32, oid, ps, pe, limit int64, pool int32) (res []*model.DM, dmids []int64, err error)

IndexsSeg get segment index info from db by ps and pe.

func (*Dao) IndexsSegID

func (d *Dao) IndexsSegID(c context.Context, tp int32, oid, ps, pe, limit int64, pool int32) (dmids []int64, err error)

IndexsSegID get segment dmids.

func (*Dao) MaskMids

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

MaskMids get mask mids from db.

func (*Dao) OneTask

func (d *Dao) OneTask(c context.Context) (task *model.TaskInfo, err error)

OneTask .

func (*Dao) Ping

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

Ping dm dao ping.

func (*Dao) RankList

func (d *Dao) RankList(c context.Context, tid int64, day int32) (resp *model.RankRecentResp, err error)

RankList get data rank by tid

func (*Dao) SendWechatWorkMsg

func (d *Dao) SendWechatWorkMsg(c context.Context, content, title string, users []string) (err error)

SendWechatWorkMsg send wechat work msg.

func (*Dao) SetDMCache

func (d *Dao) SetDMCache(c context.Context, tp int32, oid int64, dms []*model.DM) (err error)

SetDMCache flush dm list to redis.

func (*Dao) SetDMSegCache

func (d *Dao) SetDMSegCache(c context.Context, tp int32, oid, total, num int64, dmSeg *model.DMSeg) (err error)

SetDMSegCache set segment dm to cache.

func (*Dao) SetDurationCache

func (d *Dao) SetDurationCache(c context.Context, oid, duration int64) (err error)

SetDurationCache set video duration to redis.

func (*Dao) SetXMLSegCache

func (d *Dao) SetXMLSegCache(c context.Context, tp int32, oid, cnt, num int64, value []byte) (err error)

SetXMLSegCache set dm xml content into memcache.

func (*Dao) SetnxMaskJob

func (d *Dao) SetnxMaskJob(c context.Context, value string) (ok bool, err error)

SetnxMaskJob setnx mask_job value

func (*Dao) SetnxTaskJob

func (d *Dao) SetnxTaskJob(c context.Context, value string) (ok bool, err error)

SetnxTaskJob setnx task_job value

func (*Dao) SubTask

func (d *Dao) SubTask(c context.Context, id int64) (subTask *model.SubTask, err error)

SubTask .

func (*Dao) Subject

func (d *Dao) Subject(c context.Context, tp int32, oid int64) (s *model.Subject, err error)

Subject get subject info from db.

func (*Dao) SubjectCache

func (d *Dao) SubjectCache(c context.Context, tp int32, oid int64) (sub *model.Subject, err error)

SubjectCache get subject from memcache.

func (*Dao) SubjectsCache

func (d *Dao) SubjectsCache(c context.Context, tp int32, oids []int64) (cached map[int64]*model.Subject, missed []int64, err error)

SubjectsCache multi get subject from memcache.

func (*Dao) TaskInfoByID

func (d *Dao) TaskInfoByID(c context.Context, id int64) (task *model.TaskInfo, err error)

TaskInfoByID .

func (*Dao) TaskInfos

func (d *Dao) TaskInfos(c context.Context, state int32) (tasks []*model.TaskInfo, err error)

TaskInfos task infos.

func (*Dao) TaskSearchRes

func (d *Dao) TaskSearchRes(c context.Context, task *model.TaskInfo) (count int64, result string, state int32, err error)

TaskSearchRes get res from BI url

func (*Dao) Transfers

func (d *Dao) Transfers(c context.Context, state int8) (trans []*model.Transfer, err error)

Transfers get all transfer job

func (*Dao) TrimDMCache

func (d *Dao) TrimDMCache(c context.Context, tp int32, oid, count int64) (err error)

TrimDMCache 从redis列表中pop掉count条弹幕.

func (*Dao) TrimRecentDM

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

TrimRecentDM zrange remove recent dm of up.

func (*Dao) TxAddContent

func (d *Dao) TxAddContent(tx *sql.Tx, oid int64, m *model.Content) (id int64, err error)

TxAddContent add content of dm by transcation.

func (*Dao) TxAddContentSpecial

func (d *Dao) TxAddContentSpecial(tx *sql.Tx, m *model.ContentSpecial) (id int64, err error)

TxAddContentSpecial add special dm by transcation.

func (*Dao) TxAddIndex

func (d *Dao) TxAddIndex(tx *sql.Tx, m *model.DM) (id int64, err error)

TxAddIndex add index of dm by transcation.

func (*Dao) TxAddSubtitlePub

func (d *Dao) TxAddSubtitlePub(tx *sql.Tx, subtitlePub *model.SubtitlePub) (err error)

TxAddSubtitlePub .

func (*Dao) TxIncrSubMCount

func (d *Dao) TxIncrSubMCount(tx *sql.Tx, tp int32, oid int64) (affect int64, err error)

TxIncrSubMCount update monitor dm count.

func (*Dao) TxIncrSubjectCount

func (d *Dao) TxIncrSubjectCount(tx *sql.Tx, tp int32, oid, acount, count int64, childpool int32) (affect int64, err error)

TxIncrSubjectCount update acount,count,childpool of dm by transcation.

func (*Dao) TxUpdateSubtitle

func (d *Dao) TxUpdateSubtitle(tx *sql.Tx, subtitle *model.Subtitle) (err error)

TxUpdateSubtitle .

func (*Dao) UpdateChildpool

func (d *Dao) UpdateChildpool(c context.Context, tp int32, oid int64, childpool int32) (affect int64, err error)

UpdateChildpool update childpool.

func (*Dao) UpdateSubAttr

func (d *Dao) UpdateSubAttr(c context.Context, tp int32, oid int64, attr int32) (affect int64, err error)

UpdateSubAttr .

func (*Dao) UpdateSubMid

func (d *Dao) UpdateSubMid(c context.Context, tp int32, oid, mid int64) (affect int64, err error)

UpdateSubMid update mid in dm_subject.

func (*Dao) UpdateSubtitle

func (d *Dao) UpdateSubtitle(c context.Context, subtitle *model.Subtitle) (err error)

UpdateSubtitle update subtitle mid

func (*Dao) UpdateTask

func (d *Dao) UpdateTask(c context.Context, task *model.TaskInfo) (affected int64, err error)

UpdateTask update dm task.

func (*Dao) UpdateTransfer

func (d *Dao) UpdateTransfer(c context.Context, t *model.Transfer) (affect int64, err error)

UpdateTransfer change transfer job state.

func (*Dao) UpsertDmSpecialLocation

func (d *Dao) UpsertDmSpecialLocation(c context.Context, tp int32, oid int64, locations string) (err error)

UpsertDmSpecialLocation .

func (*Dao) UptSubTask

func (d *Dao) UptSubTask(c context.Context, taskID, delCount int64, end time.Time) (affected int64, err error)

UptSubTask uopdate dm sub task.

func (*Dao) UptSubjectCount

func (d *Dao) UptSubjectCount(c context.Context, tp int32, oid, count int64) (affected int64, err error)

UptSubjectCount update count.

func (*Dao) Videos

func (d *Dao) Videos(c context.Context, aid int64) (videos []*model.Video, err error)

Videos 根据aid获取分批信息,包含未开放浏览分批.

func (*Dao) XMLCache

func (d *Dao) XMLCache(c context.Context, oid int64) (data []byte, err error)

XMLCache get xml content.

func (*Dao) ZRemRecentDM

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

ZRemRecentDM remove recent dm of up.

Jump to

Keyboard shortcuts

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