db

package
v0.0.0-...-62160e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func ACollectAdd

func ACollectAdd(aHashId string, uHashId string, tag string) error

func ACollectCtGet

func ACollectCtGet(aHashId string) (error, int64)

func ACollectCtGetByAids

func ACollectCtGetByAids(aHashIds []string) (error, map[string]int64)

func ACollectDel

func ACollectDel(aHashId string, uHashId string) error

func ACollectDelByAid

func ACollectDelByAid(aHashId string) error

func ACollectExist

func ACollectExist(aHashId string, uHashId string) (error, bool)

func AFavorite

func AFavorite(aHashId string, uHashId string, status int32) error

func AFavoriteCtGet

func AFavoriteCtGet(aHashId string) (error, int64)

AFavoriteCtGet 获取文章的点赞数量

func AFavoriteCtGetByAids

func AFavoriteCtGetByAids(aHashIds []string) (error, map[string]int64)

func AFavoriteDeleteByAid

func AFavoriteDeleteByAid(aHashId string) error

func AFavoriteExist

func AFavoriteExist(aHashId string, uHashId string) (err error, exSignal int32)

func AFavoriteStatusFlush

func AFavoriteStatusFlush(aHashId string, uHashId string, fluSignal int32) error

func AddNewComment

func AddNewComment(ctx context.Context, comment *mymongo.Comment) error

AddNewComment add a comment

func AddNewFollow

func AddNewFollow(follow *orm_gen.Follow) error

func CheckArticleExistByHashId

func CheckArticleExistByHashId(ahashId string) (bool, error)

CheckArticleExistByHashId 根据文章的hash_id 字段查找文章

func CheckArticleExistById

func CheckArticleExistById(aid int64) (bool, error)

CheckArticleExistById query if video exist

func CheckCmtExistById

func CheckCmtExistById(ctx context.Context, cHashId string) (exist bool, err error)

func CheckUserExistByHashId

func CheckUserExistByHashId(hashId string) (bool, error)

func CheckUserExistById

func CheckUserExistById(userId int64) (bool, error)

CheckUserExistById find if user exists

func CheckUserExistByUname

func CheckUserExistByUname(username string) (bool, error)

func CmtFavorieExist

func CmtFavorieExist(UHashId string, CHashId string) (error, bool)

func CmtFavoriteAction

func CmtFavoriteAction(UHashId string, CHashId string, AHashId string, actionTp int32) error

func CmtFavoriteFlushByArticleId

func CmtFavoriteFlushByArticleId(AHashId string) error

CmtFavoriteFlushByArticleId 删除文章的时候,调用该函数

func CmtFavoriteFlushByCmtId

func CmtFavoriteFlushByCmtId(CHashId string) error

CmtFavoriteFlushByCmtId 删除评论的时候,调用该函数

func CmtFavoriteStatus

func CmtFavoriteStatus(UHashId string, CHashId string) (error, int32)

func CmtFavoriteStatusFlush

func CmtFavoriteStatusFlush(UHashId string, CHashId string) error

func CreateArticle

func CreateArticle(aInfo *orm_gen.Article, aContent string) error

func CreateUser

func CreateUser(user *orm_gen.User) error

CreateUser create user info

func DelCommentByAid

func DelCommentByAid(ctx context.Context, aHashId string) error

DelCommentByAid 删除文章前,调用该函数

func DelCommentByHashID

func DelCommentByHashID(ctx context.Context, cHashId string, aHashId string) error

DelCommentByHashID DeleteCommentById delete comment by comment id

func DeleteArticle

func DeleteArticle(aInfo *orm_gen.Article) (err error)

func DeleteFollow

func DeleteFollow(follow *orm_gen.Follow) error

DeleteFollow delete follow relation in db and update redis

func GetArticleInfos

func GetArticleInfos(uid string, offset int) (aInfos []*orm_gen.Article, err error)

GetArticleInfos: 获取一系列的文章卡片

func GetCmtCountByAid

func GetCmtCountByAid(ctx context.Context, aHashId string) (error, int64)

func GetCmtCtByAids

func GetCmtCtByAids(ctx context.Context, aHashIds []string) (error, map[string]int64)

GetCmtCtByAids 通过文章id获取该文章的评论数

func GetCmtFavoriteCtMap

func GetCmtFavoriteCtMap(cids []string) (error, map[string]int64)

func GetCmtFavoriteStatusMap

func GetCmtFavoriteStatusMap(CHashIds []string, UHashId string) (error, map[string]int32)

func GetCommentByCmtID

func GetCommentByCmtID(ctx context.Context, cHashId string) (cmt *mymongo.Comment, err error)

GetCommentByCmtID GetCommentByTopCmtID 根据comment hashid 获取评论

func GetCommentListByArticleID

func GetCommentListByArticleID(ctx context.Context, aHashId string) ([]*mymongo.CommentItem, error)

GetCommentListByArticleID 通过文章id获取所有的一级评论

func GetCommentListByTopCommentID

func GetCommentListByTopCommentID(ctx context.Context, aHashId string, cHashId string) (cmtList []*mymongo.CommentItem, err error)

func GetFollowCount

func GetFollowCount(uHashId string) (int64, error)

GetFollowCount query the number of users following

func GetFollowIdList

func GetFollowIdList(uHashId string) ([]string, error)

getFollowIdList find user_id follow id list in db

func GetFollowerCount

func GetFollowerCount(uHashId string) (int64, error)

GetFollowerCount query the number of followers of a user

func GetFollowerIdList

func GetFollowerIdList(uHashId string) ([]string, error)

getFollowerIdList get follower id list in db

func GetWorkCount

func GetWorkCount(uHashId string) (count int64, err error)

GetWorkCount get the num of video published by the user

func Init

func Init()

Init init DB

func ModifyArticle

func ModifyArticle(aInfo *orm_gen.Article, aContent string) (hashAid string, err error)

func QueryFollowExist

func QueryFollowExist(uHashId, fUHashId string) (bool, error)

QueryFollowExist check the relation of user and follower

func QueryUser

func QueryUser(userName string) (*orm_gen.User, error)

QueryUser query User by user_name

func QueryUserByHashId

func QueryUserByHashId(uHashId string) (*orm_gen.User, error)

func QueryUserByHashIds

func QueryUserByHashIds(uids []string) (uMaps map[string]*orm_gen.User, err error)

func QueryUserById

func QueryUserById(userId int64) (*orm_gen.User, error)

QueryUserById get user in the database by user id

func QueryUserByIds

func QueryUserByIds(uids []int64) (map[int64]*orm_gen.User, error)

map[user id] : user payload

func StartPeriodicSyncForViewCt

func StartPeriodicSyncForViewCt()

StartPeriodicSyncForViewCt 定期任务,每 10 分钟将 Redis 中的view count数据同步到 MySQL

func TakeArticle

func TakeArticle(aHashID string) (aInfo *orm_gen.Article, content string, err error)

TakeArticle: 获取文章info以及内容

func UserProfileModify

func UserProfileModify(user_id int64, payload map[string]interface{}) error

func UserPwdModify

func UserPwdModify(uid int64, new_pwd string) error

func VerifyUser

func VerifyUser(userName string, password string) (int64, string, error)

VerifyUser verify username and password in the db

func ViewCountDel

func ViewCountDel(ahashId string) error

ViewCountDel 删除文章的时候,调用该函数

func ViewCountExist

func ViewCountExist(ahashId string) (error, bool)

func ViewCountGet

func ViewCountGet(ahashId string) (error, int64)

func ViewCountGets

func ViewCountGets(ahashId []string) (error, map[string]int64)

func ViewCountIncr

func ViewCountIncr(ahashId string) error

func ViewCountInit

func ViewCountInit(ahashId string) error

ViewCountInit 在创建文章后调用该函数,在redis里初始化文章阅读数记录

Types

This section is empty.

Jump to

Keyboard shortcuts

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