fav

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: 15 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 new a dao and return.

func (*Dao) AddAllRelationCache

func (d *Dao) AddAllRelationCache(c context.Context, m *favmdl.Favorite) (err error)

AddAllRelationCache add a relation to redis.

func (*Dao) AddAllRelationsCache

func (d *Dao) AddAllRelationsCache(c context.Context, mid, fid int64, fs []*favmdl.Favorite) (err error)

AddAllRelationsCache add a relation to redis.

func (*Dao) AddRelation

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

AddRelation add a favorite relation to mysql.

func (*Dao) AddRelationCache

func (d *Dao) AddRelationCache(c context.Context, m *favmdl.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) AddRelationsCache

func (d *Dao) AddRelationsCache(c context.Context, tp int8, mid, fid int64, fs []*favmdl.Favorite) (err error)

AddRelationsCache add a relation to redis.

func (*Dao) AddUser

func (d *Dao) AddUser(c context.Context, u *favmdl.User) (rows int64, err error)

AddUser add a favorite user to mysql.

func (*Dao) AllRelations

func (d *Dao) AllRelations(c context.Context, mid, fid int64, mtime xtime.Time, limit int) (fr []*favmdl.Favorite, err error)

AllRelations get favorite relations from mysql.

func (*Dao) BatchUpdateSeq

func (d *Dao) BatchUpdateSeq(c context.Context, mid int64, favs []*favmdl.Favorite) (int64, error)

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() (err error)

Close close all connection.

func (*Dao) DefaultFolderCache

func (d *Dao) DefaultFolderCache(c context.Context, tp int8, mid int64) (folder *favmdl.Folder, err error)

DefaultFolderCache return default favorite folder from redis.

func (*Dao) DelAllRelationCache

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

DelAllRelationCache delete one relation cache.

func (*Dao) DelAllRelationsCache

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

DelAllRelationsCache delete the folder relation cache.

func (*Dao) DelBatchOidsMc

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

DelBatchOidsMc delete oids mc cache.

func (*Dao) DelNewCoverCache

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

DelNewCoverCache delete cover picture cache.

func (*Dao) DelOldRelationsCache

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

DelOldRelationsCache delete the folder relation cache. TODO:del at 2018.06.08

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, now xtime.Time) (rows int64, err error)

DelRelation delete a favorite relation to mysql.

func (*Dao) DelRelationCache

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

DelRelationCache delete one relation cache.

func (*Dao) DelRelationFidsMc

func (d *Dao) DelRelationFidsMc(c context.Context, typ int8, mid, oid 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) DelRelationsByOids

func (d *Dao) DelRelationsByOids(c context.Context, typ int8, mid, fid int64, oids []int64, now xtime.Time) (rows int64, err error)

DelRelationsByOids update del state by fid and oids.

func (*Dao) DelRelationsCache

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

DelRelationsCache delete the folder relation cache.

func (*Dao) DelUser

func (d *Dao) DelUser(c context.Context, u *favmdl.User) (rows int64, err error)

DelUser delete a favorite user.

func (*Dao) ExpireAllRelations

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

ExpireAllRelations expire folder relations 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) Folder

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

Folder get a Folder by fid from mysql.

func (*Dao) FolderCache

func (d *Dao) FolderCache(c context.Context, tp int8, mid, fid int64) (folder *favmdl.Folder, err error)

FolderCache return a favorite folder from redis.

func (*Dao) FolderMc

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

FolderMc return one folder from mc.

func (*Dao) MaxRelation

func (d *Dao) MaxRelation(c context.Context, mid, fid int64) (m *favmdl.Favorite, err error)

MaxRelation get a max sequence relation from mysql.

func (*Dao) MaxScore

func (d *Dao) MaxScore(c context.Context, m *favmdl.Favorite) (score int64, err error)

MaxScore get the max score from sorted set

func (*Dao) OidsByFid

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

OidsByFid get oids by fid

func (*Dao) Ping

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

Ping ping all resource.

func (*Dao) RecentRes

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

RecentRes 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 *favmdl.Favorite, err error)

Relation get a relation from mysql.

func (*Dao) RelationCnt

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

RelationCnt get favoried folders count in relation from mysql.

func (*Dao) RelationCntCache

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

RelationCntCache return the folder all relation count from redis.

func (*Dao) RelationFids

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

RelationFids get the map [oid -> "fid,fid"] for user.

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

func (d *Dao) Relations(c context.Context, typ int8, mid, fid int64, mtime xtime.Time, limit int) (fr []*favmdl.Favorite, err error)

Relations get favorite relations from mysql.

func (*Dao) RelationsByOids

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

func (*Dao) RemRelationOidCache

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

RemRelationOidCache del favoured oid.

func (*Dao) SetCleanedCache

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

SetCleanedCache .

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

func (d *Dao) SetFoldersMc(c context.Context, vs ...*favmdl.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 return oid count from 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) SetRelationOidsCache

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

SetRelationOidsCache set favoured oids .

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

func (d *Dao) StatCnt(c context.Context, tp int8, oid int64) (cnt int, err error)

StatCnt return stat count from mysql.

func (*Dao) TxUpdateFavSequence

func (d *Dao) TxUpdateFavSequence(tx *xsql.Tx, mid int64, fid, oid int64, typ int8, sequence uint64, mtime xtime.Time) (rows int64, err error)

func (*Dao) UpFolderCnt

func (d *Dao) UpFolderCnt(c context.Context, mid, fid int64, cnt int, now xtime.Time) (rows int64, err error)

UpFolderCnt update folder count to mysql.

func (*Dao) UpStatCnt

func (d *Dao) UpStatCnt(c context.Context, tp int8, oid int64, incr int, now xtime.Time) (rows int64, err error)

UpStatCnt update stat count to mysql.

Jump to

Keyboard shortcuts

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