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: 19 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 favorite dao.

func New

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

New a dao and return.

func (*Dao) AddFav

func (d *Dao) AddFav(c context.Context, fr *model.Favorite) (rows int64, err error)

AddFav add a favorite relation to mysql.

func (*Dao) AddFidsRedis

func (d *Dao) AddFidsRedis(c context.Context, typ int8, mid int64, fs ...*model.Folder) (err error)

AddFidsRedis set user's fids to redis

func (*Dao) AddFolder

func (d *Dao) AddFolder(c context.Context, f *model.Folder) (fid int64, err error)

AddFolder add a new favorite folder to mysql.

func (*Dao) AddFoldersCache

func (d *Dao) AddFoldersCache(c context.Context, tp int8, mid int64, folders []*model.Folder) (err error)

AddFoldersCache add the user all folders to redis.

func (*Dao) AddRelation

func (d *Dao) AddRelation(c context.Context, fr *model.Favorite) (rows int64, err error)

AddRelation add a favorite relation to mysql.

func (*Dao) AddRelationCache

func (d *Dao) AddRelationCache(c context.Context, m *model.Favorite) (err error)

AddRelationCache add a relation to redis.

func (*Dao) AddRelationOidCache

func (d *Dao) AddRelationOidCache(c context.Context, tp int8, mid, oid int64) (err error)

AddRelationOidCache add favoured oid.

func (*Dao) BatchOids

func (d *Dao) BatchOids(c context.Context, typ int8, mid int64, limit int) (oids []int64, err error)

BatchOids get batch oids from mysql.

func (*Dao) BatchOidsMc

func (d *Dao) BatchOidsMc(c context.Context, typ int8, mid int64) (oids []int64, err error)

BatchOidsMc return oids from mc.

func (*Dao) BatchOidsRedis

func (d *Dao) BatchOidsRedis(c context.Context, tp int8, mid int64, limit int) (oids []int64, err error)

BatchOidsRedis return the user's 1000 oids from redis.

func (*Dao) BeginTran

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

BeginTran crate a *sql.Tx for database transaction.

func (*Dao) Close

func (d *Dao) Close()

Close close all connection.

func (*Dao) CntAllRelations

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

CntRelations get favoried folders count in relation from mysql.

func (*Dao) CntAllRelationsCache

func (d *Dao) CntAllRelationsCache(c context.Context, mid, fid int64) (cnt int, err error)

CntAllRelationsCache return the folder all relation count from redis.

func (*Dao) CntRelations

func (d *Dao) CntRelations(c context.Context, mid, fid int64, typ int8) (count int, err error)

CntRelations get favoried folders count in relation from mysql.

func (*Dao) CntRelationsCache

func (d *Dao) CntRelationsCache(c context.Context, mid, fid int64) (cnt int, err error)

CntRelationsCache return the folder all relation count from redis.

func (*Dao) CntUsers

func (d *Dao) CntUsers(c context.Context, typ int8, oid int64) (count int, err error)

CntUsers get favoried users count from mysql.

func (*Dao) CopyRelations

func (d *Dao) CopyRelations(c context.Context, typ int8, oldmid, mid, oldfid, newfid int64, oids []int64) (rows int64, err error)

CopyRelations copy resources from oldfid to newfid by oids.

func (*Dao) DefaultFolder

func (d *Dao) DefaultFolder(c context.Context, tp int8, mid int64) (f *model.Folder, err error)

DefaultFolder get default folder from mysql.

func (*Dao) DelAllRelationsCache

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

DelRelationsCache delete the folder relation cache.

func (*Dao) DelFav

func (d *Dao) DelFav(c context.Context, tp int8, mid, fid, oid int64) (rows int64, err error)

DelFav delete a favorite relation to mysql.

func (*Dao) DelFidsRedis

func (d *Dao) DelFidsRedis(c context.Context, typ int8, mid int64) (err error)

DelFidsRedis delete user's all fids from redis.

func (*Dao) DelFolder

func (d *Dao) DelFolder(c context.Context, tp int8, mid, fid int64) (rows int64, err error)

DelFolder delete a folder to mysql.

func (*Dao) DelFolderMc

func (d *Dao) DelFolderMc(c context.Context, typ int8, mid, fid int64) (err error)

DelFolderMc delete folder mc cache.

func (*Dao) DelFolderSortMc

func (d *Dao) DelFolderSortMc(c context.Context, typ int8, mid int64) (err error)

DelFolderSortMc delete folder's sort mc cache.

func (*Dao) DelRecentOidsMc

func (d *Dao) DelRecentOidsMc(c context.Context, typ int8, mid int64) (err error)

DelRecentOidsMc delete recent oids mc cache.

func (*Dao) DelRecentResMc

func (d *Dao) DelRecentResMc(c context.Context, typ int8, mid int64) (err error)

DelRecentResMc delete recent oids mc cache.

func (*Dao) DelRelation

func (d *Dao) DelRelation(c context.Context, tp int8, mid, fid, oid int64) (rows int64, err error)

DelRelation delete a favorite relation to mysql.

func (*Dao) DelRelationFidsMc

func (d *Dao) DelRelationFidsMc(c context.Context, typ int8, mid int64, oids ...int64) (err error)

DelRelationFidsMc delete oid's fid mc cache.

func (*Dao) DelRelationOidsCache

func (d *Dao) DelRelationOidsCache(c context.Context, typ int8, mid int64) (err error)

DelRelationOidsCache .

func (*Dao) DelRelationsCache

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

DelRelationsCache delete the folder relation cache.

func (*Dao) ExpireAllRelations

func (d *Dao) ExpireAllRelations(c context.Context, mid, fid int64) (ok bool, err error)

ExpireAllRelations expire folder relations cache.

func (*Dao) ExpireFolder

func (d *Dao) ExpireFolder(c context.Context, tp int8, mid int64) (ok bool, err error)

ExpireFolder expire folder cache.

func (*Dao) ExpireRelationOids

func (d *Dao) ExpireRelationOids(c context.Context, tp int8, mid int64) (ok bool, err error)

ExpireRelationOids set expire for faved oids.

func (*Dao) ExpireRelations

func (d *Dao) ExpireRelations(c context.Context, mid, fid int64) (ok bool, err error)

ExpireRelations expire folder relations cache.

func (*Dao) FavedBit

func (d *Dao) FavedBit(c context.Context, tp int8, mid int64) (unfaved bool, err error)

FavedBit check if user had fav video by bit value

func (*Dao) FidsRedis

func (d *Dao) FidsRedis(c context.Context, tp int8, mid int64) (fids []int64, err error)

FidsRedis return the user's all fids from redis.

func (*Dao) Folder

func (d *Dao) Folder(c context.Context, tp int8, mid, fid int64) (f *model.Folder, err error)

Folder get a Folder by fid from mysql.

func (*Dao) FolderAllRelations

func (d *Dao) FolderAllRelations(c context.Context, mid, fid int64, start, end int) (fr []*model.Favorite, err error)

FolderAllRelations get favorite relations from mysql.

func (*Dao) FolderAllRelationsCache

func (d *Dao) FolderAllRelationsCache(c context.Context, typ int8, mid, fid int64, start, end int) (res []*model.Favorite, err error)

FolderRelationsCache return the folder all relations from redis.

func (*Dao) FolderByName

func (d *Dao) FolderByName(c context.Context, tp int8, mid int64, name string) (f *model.Folder, err error)

FolderByName get a Folder by name from mysql.

func (*Dao) FolderCnt

func (d *Dao) FolderCnt(c context.Context, tp int8, mid int64) (count int, err error)

FolderCnt get user's folder count.

func (*Dao) FolderMc

func (d *Dao) FolderMc(c context.Context, typ int8, mid, fid int64) (f *model.Folder, err error)

FolderMc return folder pb from mc.

func (*Dao) FolderRelations

func (d *Dao) FolderRelations(c context.Context, typ int8, mid, fid int64, start, end int) (fr []*model.Favorite, err error)

FolderRelations get favorite relations from mysql.

func (*Dao) FolderRelationsCache

func (d *Dao) FolderRelationsCache(c context.Context, typ int8, mid, fid int64, start, end int) (res []*model.Favorite, err error)

FolderRelationsCache return the folder all relations from redis.

func (*Dao) FolderSort

func (d *Dao) FolderSort(c context.Context, typ int8, mid int64) (fst *model.FolderSort, err error)

FolderSort return user's folders sort by type & mid.

func (*Dao) FolderSortMc

func (d *Dao) FolderSortMc(c context.Context, typ int8, mid int64) (fst *model.FolderSort, err error)

FolderSortMc return folder sort binary from mc.

func (*Dao) FolderStats

func (d *Dao) FolderStats(c context.Context, fvmids []*model.ArgFVmid) (fs map[int64]*model.Folder, err error)

FolderStats get folders from mysql.

func (*Dao) FolderStatsMc

func (d *Dao) FolderStatsMc(c context.Context, fvmids []*model.ArgFVmid) (fs map[int64]*model.Folder, missFvmids []*model.ArgFVmid, err error)

FolderStatsMc return folders stat by mid & fid from mc.

func (*Dao) Folders

func (d *Dao) Folders(c context.Context, fvmids []*model.ArgFVmid) (fs map[string]*model.Folder, err error)

Folders get folders from mysql.

func (*Dao) FoldersMc

func (d *Dao) FoldersMc(c context.Context, fvmids []*model.ArgFVmid) (fs map[string]*model.Folder, missFvmids []*model.ArgFVmid, err error)

FoldersMc return folders by mid & fid from mc.

func (*Dao) IsCleaned

func (d *Dao) IsCleaned(c context.Context, typ int8, mid, fid int64) (cleanedTime int64, err error)

IsCleaned check if user had do clean action

func (*Dao) IsFavedCache

func (d *Dao) IsFavedCache(c context.Context, tp int8, mid int64, oid int64) (isFaved bool, err error)

IsFavedCache return true or false to judge object whether faved by user.

func (*Dao) IsFavedsCache

func (d *Dao) IsFavedsCache(c context.Context, tp int8, mid int64, oids []int64) (favoreds map[int64]bool, err error)

IsFavedsCache return true or false to judge object whether faved by user.

func (*Dao) MultiAddRelations

func (d *Dao) MultiAddRelations(c context.Context, tp int8, mid, fid int64, oids []int64) (rows int64, err error)

MultiAddRelations insert relations to mysql.

func (*Dao) MultiDelRelations

func (d *Dao) MultiDelRelations(c context.Context, tp int8, mid, fid int64, oids []int64) (rows int64, err error)

MultiDelRelations delete relations to mysql.

func (*Dao) MultiExpireAllRelations

func (d *Dao) MultiExpireAllRelations(c context.Context, mid int64, fids []int64) (map[int64]bool, error)

MultiExpireRelations expire folders's relations cache.

func (*Dao) MultiExpireRelations

func (d *Dao) MultiExpireRelations(c context.Context, mid int64, fids []int64) (map[int64]bool, error)

MultiExpireRelations expire folders's relations cache.

func (*Dao) OidCount

func (d *Dao) OidCount(c context.Context, typ int8, oid int64) (count int64, err error)

OidCount get oid's fav count from mysql.

func (*Dao) OidCountMc

func (d *Dao) OidCountMc(c context.Context, typ int8, oid int64) (count int64, err error)

OidCountMc return oid count from mc.

func (*Dao) OidsCount

func (d *Dao) OidsCount(c context.Context, typ int8, oids []int64) (counts map[int64]int64, err error)

OidsCount get oids's count from mysql.

func (*Dao) OidsCountMc

func (d *Dao) OidsCountMc(c context.Context, typ int8, oids []int64) (counts map[int64]int64, misOids []int64, err error)

OidsCountMc return oids's count from mc.

func (*Dao) Ping

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

Ping check connection used in dao

func (*Dao) PubAddFav

func (d *Dao) PubAddFav(c context.Context, tp int8, mid, fid, oid int64, attr int32, ts int64, otype int8)

PubAddFav push the add resource event into databus.

func (*Dao) PubAddFolder

func (d *Dao) PubAddFolder(c context.Context, typ int8, mid, fid int64, attr int32)

PubAddFolder push the add folder action event into databus.

func (*Dao) PubClean

func (d *Dao) PubClean(c context.Context, typ int8, mid, fid, ftime int64)

PubClean push the clean video event into databus.

func (*Dao) PubCopyFavs

func (d *Dao) PubCopyFavs(c context.Context, typ int8, mid, ofid, nfid, rows int64, oids []int64, ts int64)

PubCopyFavs push the copy resources event into databus.

func (*Dao) PubDelFav

func (d *Dao) PubDelFav(c context.Context, tp int8, mid, fid, oid int64, attr int32, ts int64, otype int8)

PubDelFav push the delete favorite event into databus.

func (*Dao) PubDelFolder

func (d *Dao) PubDelFolder(c context.Context, typ int8, mid, fid int64, attr int32, ts int64)

PubDelFolder push the del folder action event into databus.

func (*Dao) PubInitAllFolderRelations

func (d *Dao) PubInitAllFolderRelations(c context.Context, tp int8, mid, fid int64)

PubInitAllFolderRelations push the folder relations cache event into databus.

func (*Dao) PubInitFolderRelations

func (d *Dao) PubInitFolderRelations(c context.Context, tp int8, mid, fid int64)

PubInitFolderRelations push the folder relations cache event into databus.

func (*Dao) PubInitRelationFids

func (d *Dao) PubInitRelationFids(c context.Context, tp int8, mid int64)

PubInitRelationFids push the relationfids cache event into databus.

func (*Dao) PubMoveFavs

func (d *Dao) PubMoveFavs(c context.Context, typ int8, mid, ofid, nfid, rows int64, oids []int64, ts int64)

PubMoveFavs push the move resources event into databus.

func (*Dao) PubMultiAddFavs

func (d *Dao) PubMultiAddFavs(c context.Context, typ int8, mid, fid, rows int64, attr int32, oids []int64, ts int64)

PubMultiAddFavs push the multi add fav relations event into databus.

func (*Dao) PubMultiDelFavs

func (d *Dao) PubMultiDelFavs(c context.Context, typ int8, mid, fid, rows int64, attr int32, oids []int64, ts int64)

PubMultiDelFavs push the multi del fav relations event into databus.

func (*Dao) PubSortFavs

func (d *Dao) PubSortFavs(c context.Context, tp int8, mid, fid int64, sorts []model.SortFav)

PubAddFav push the add resource event into databus.

func (*Dao) RecentOids

func (d *Dao) RecentOids(c context.Context, mid, fid int64, typ int8) (oids []int64, err error)

RecentOids return user's three newest fav from a folder.

func (*Dao) RecentOidsCache

func (d *Dao) RecentOidsCache(c context.Context, typ int8, mid int64, fids []int64) (rctFidsMap map[int64][]int64, missFids []int64, err error)

RecentOidsCache return three recent oids of all user's folders from redis.

func (*Dao) RecentRes

func (d *Dao) RecentRes(c context.Context, mid, fid int64) (res []*model.Resource, err error)

RecentOids return user's three newest fav from a folder.

func (*Dao) RelaitonFidsMc

func (d *Dao) RelaitonFidsMc(c context.Context, typ int8, mid, oid int64) (fids []int64, err error)

RelaitonFidsMc return fids from mc.

func (*Dao) Relation

func (d *Dao) Relation(c context.Context, tp int8, mid, fid, oid int64) (m *model.Favorite, err error)

Relation get a relation from mysql.

func (*Dao) RelationFidsByOid

func (d *Dao) RelationFidsByOid(c context.Context, tp int8, mid, oid int64) (fids []int64, err error)

RelationFidsByOid get favortied folders in relations by oid from mysql.

func (*Dao) RelationFidsByOids

func (d *Dao) RelationFidsByOids(c context.Context, tp int8, mid int64, oids []int64) (fidsMap map[int64][]int64, err error)

RelationFidsByOids get favortied folders in relations by oid from mysql.

func (*Dao) RemFidsRedis

func (d *Dao) RemFidsRedis(c context.Context, typ int8, mid int64, fs ...*model.Folder) (err error)

RemFidsRedis del user's fids in redis

func (*Dao) RemRelationOidCache

func (d *Dao) RemRelationOidCache(c context.Context, tp int8, mid, oid int64) (err error)

RemRelationOidCache del faved oid.

func (*Dao) SearchArcs

func (d *Dao) SearchArcs(c context.Context, keyword string, ids []int64, pn, ps int) (res *schmdl.IDsResp, err error)

SearchArcs return archive ids by aids.

func (*Dao) SetBatchOidsMc

func (d *Dao) SetBatchOidsMc(c context.Context, typ int8, mid int64, oids []int64) (err error)

SetBatchOidsMc set oids binary data to mc.

func (*Dao) SetCleanedCache

func (d *Dao) SetCleanedCache(c context.Context, typ int8, mid, fid, ftime, expire int64) (err error)

SetCleanedCache set cleand flag.

func (*Dao) SetFavedBit

func (d *Dao) SetFavedBit(c context.Context, tp int8, mid int64) (err error)

SetFavedBit set unfaved user bit to 0

func (*Dao) SetFolderSortMc

func (d *Dao) SetFolderSortMc(c context.Context, fst *model.FolderSort) (err error)

SetFolderSortMc set folder's sort binary data to mc.

func (*Dao) SetFolderStatsMc

func (d *Dao) SetFolderStatsMc(c context.Context, stats map[int64]*model.Folder) (err error)

SetFolderStatsMc add folders mc cache.

func (*Dao) SetFoldersMc

func (d *Dao) SetFoldersMc(c context.Context, vs ...*model.Folder) (err error)

SetFoldersMc add folders mc cache.

func (*Dao) SetOidCountMc

func (d *Dao) SetOidCountMc(c context.Context, typ int8, oid, count int64) (err error)

SetOidCountMc set oid count to mc.

func (*Dao) SetOidsCountMc

func (d *Dao) SetOidsCountMc(c context.Context, typ int8, cnts map[int64]int64) (err error)

SetOidsCountMc set oids count to mc.

func (*Dao) SetRelaitonFidsMc

func (d *Dao) SetRelaitonFidsMc(c context.Context, typ int8, mid, oid int64, fids []int64) (err error)

SetRelaitonFidsMc set fids binary data to mc.

func (*Dao) SetUnFavedBit

func (d *Dao) SetUnFavedBit(c context.Context, tp int8, mid int64) (err error)

SetUnFavedBit set unfaved user bit to 1

func (*Dao) SetUserRecentOidsMc

func (d *Dao) SetUserRecentOidsMc(c context.Context, typ int8, mid int64, oids []int64) (err error)

SetUserRecentOidsMc set oids binary data to mc.

func (*Dao) SetUserRecentResourcesMc

func (d *Dao) SetUserRecentResourcesMc(c context.Context, typ int8, mid int64, recents []*model.Resource) (err error)

SetUserRecentOidsMc set oids binary data to mc.

func (*Dao) TxCopyRelations

func (d *Dao) TxCopyRelations(tx *sql.Tx, typ int8, oldmid, mid, oldfid, newfid int64, oids []int64) (rows int64, err error)

TxCopyRelations copy resources from oldfid to newfid by oids.

func (*Dao) TxMultiDelRelations

func (d *Dao) TxMultiDelRelations(tx *sql.Tx, tp int8, mid, fid int64, oids []int64) (rows int64, err error)

TxMultiDelRelations delete relations to mysql.

func (*Dao) UpFolderAttr

func (d *Dao) UpFolderAttr(c context.Context, typ int8, mid, fid int64, attr int32) (rows int64, err error)

UpFolderAttr update user's folder attr to mysql.

func (*Dao) UpFolderName

func (d *Dao) UpFolderName(c context.Context, typ int8, mid, fid int64, name string) (rows int64, err error)

UpFolderName rename user's folder name to mysql.

func (*Dao) UpFolderSort

func (d *Dao) UpFolderSort(c context.Context, fst *model.FolderSort) (rows int64, err error)

UpFolderSort update user's folder sort.

func (*Dao) UpdateFolder

func (d *Dao) UpdateFolder(c context.Context, f *model.Folder) (fid int64, err error)

UpdateFolder add a new favorite folder to mysql.

func (*Dao) UserFolders

func (d *Dao) UserFolders(c context.Context, typ int8, mid int64) (fs map[int64]*model.Folder, err error)

UserFolders get user's folders.

func (*Dao) UserRecentOidsMc

func (d *Dao) UserRecentOidsMc(c context.Context, typ int8, mid int64) (oids []int64, err error)

UserRecentOidsMc return oids from mc.

func (*Dao) UserRecentResourcesMc

func (d *Dao) UserRecentResourcesMc(c context.Context, typ int8, mid int64) (recents []*model.Resource, err error)

UserRecentOidsMc return oids from mc.

func (*Dao) Users

func (d *Dao) Users(c context.Context, typ int8, oid int64, start, end int) (us []*model.User, err error)

Users get favorite users from mysql.

Jump to

Keyboard shortcuts

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