repository

package
v0.0.0-...-048bef2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 17 Imported by: 0

README

Repository

数据访问层: 包含数据库、cache、RPC、HTTP请求等

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is repo providers.

Functions

func NewRelationClient

func NewRelationClient() relationV1.RelationServiceClient

Types

type CommentContentRepo

type CommentContentRepo interface {
	CreateCommentContent(ctx context.Context, db *gorm.DB, data *model.CommentContentModel) (id int64, err error)
	UpdateCommentContent(ctx context.Context, id int64, data *model.CommentContentModel) error
	GetCommentContent(ctx context.Context, id int64) (ret *model.CommentContentModel, err error)
	BatchGetCommentContent(ctx context.Context, ids []int64) (ret map[int64]*model.CommentContentModel, err error)
}

CommentContentRepo define a repo interface

func NewCommentContent

func NewCommentContent(db *gorm.DB, cache cache.CommentContentCache) CommentContentRepo

NewCommentContent new a repository and return

type CommentHotRepo

type CommentHotRepo interface {
	CreateCommentHot(ctx context.Context, db *gorm.DB, data *model.CommentHotModel) (id int64, err error)
	UpdateCommentHot(ctx context.Context, id int64, data *model.CommentHotModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	GetCommentHot(ctx context.Context, id int64) (ret *model.CommentHotModel, err error)
	ListCommentHot(ctx context.Context, postID int64, lastID int64, limit int) (ret []int64, err error)
}

CommentHotRepo define a repo interface

func NewCommentHot

func NewCommentHot(db *gorm.DB, cache cache.CommentHotCache) CommentHotRepo

NewCommentHot new a repository and return

type CommentInfoRepo

type CommentInfoRepo interface {
	CreateCommentInfo(ctx context.Context, db *gorm.DB, data *model.CommentInfoModel) (id int64, err error)
	UpdateCommentInfo(ctx context.Context, id int64, data *model.CommentInfoModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	IncrReplyCount(ctx context.Context, db *gorm.DB, id int64) error
	IncrLikeCount(ctx context.Context, db *gorm.DB, id int64) error
	DecrLikeCount(ctx context.Context, db *gorm.DB, id int64) error
	GetCommentInfo(ctx context.Context, id int64) (ret *model.CommentInfoModel, err error)
	BatchGetCommentInfo(ctx context.Context, ids []int64) (ret []*model.CommentInfoModel, err error)
}

CommentInfoRepo define a repo interface

func NewCommentInfo

func NewCommentInfo(db *gorm.DB, cache cache.CommentInfoCache) CommentInfoRepo

NewCommentInfo new a repository and return

type CommentLatestRepo

type CommentLatestRepo interface {
	CreateCommentLatest(ctx context.Context, db *gorm.DB, data *model.CommentLatestModel) (id int64, err error)
	UpdateCommentLatest(ctx context.Context, id int64, data *model.CommentLatestModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	GetCommentLatest(ctx context.Context, id int64) (ret *model.CommentLatestModel, err error)
	ListCommentLatest(ctx context.Context, postID int64, lastID int64, limit int) (ret []int64, err error)
	// 获取评论的回复列表
	ListReplyComment(ctx context.Context, commentID int64, lastID int64, limit int) (ret []int64, err error)
}

CommentLatestRepo define a repo interface

func NewCommentLatest

func NewCommentLatest(db *gorm.DB, cache cache.CommentLatestCache) CommentLatestRepo

NewCommentLatest new a repository and return

type PostHotRepo

type PostHotRepo interface {
	CreatePostHot(ctx context.Context, db *gorm.DB, data *model.PostHotModel) (id int64, err error)
	UpdatePostHot(ctx context.Context, id int64, data *model.PostHotModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	GetPostHot(ctx context.Context, id int64) (ret *model.PostHotModel, err error)
	BatchGetPostHot(ctx context.Context, ids []int64) (ret []*model.PostHotModel, err error)
	GetHotPostList(ctx context.Context, lastId int64, limit int32) (ret []*model.PostHotModel, err error)
}

PostHotRepo define a repo interface

func NewPostHot

func NewPostHot(db *gorm.DB) PostHotRepo

NewPostHot new a repository and return

type PostInfoRepo

type PostInfoRepo interface {
	CreatePostInfo(ctx context.Context, db *gorm.DB, data *model.PostInfoModel) (id int64, err error)
	UpdatePostInfo(ctx context.Context, id int64, data *model.PostInfoModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	IncrCommentCount(ctx context.Context, db *gorm.DB, id int64) error
	DecrCommentCount(ctx context.Context, db *gorm.DB, id int64) error
	IncrLikeCount(ctx context.Context, db *gorm.DB, id int64) error
	DecrLikeCount(ctx context.Context, db *gorm.DB, id int64) error
	GetPostInfo(ctx context.Context, id int64) (ret *model.PostInfoModel, err error)
	BatchGetPostInfo(ctx context.Context, ids []int64) (ret []*model.PostInfoModel, err error)
}

PostInfoRepo define a repo interface

func NewPostInfo

func NewPostInfo(db *gorm.DB, cache cache.PostInfoCache) PostInfoRepo

NewPostInfo new a repository and return

type PostLatestRepo

type PostLatestRepo interface {
	CreatePostLatest(ctx context.Context, db *gorm.DB, data *model.PostLatestModel) (id int64, err error)
	UpdatePostLatest(ctx context.Context, id int64, data *model.PostLatestModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	GetPostLatest(ctx context.Context, id int64) (ret *model.PostLatestModel, err error)
	BatchGetPostLatest(ctx context.Context, ids []int64) (ret []*model.PostLatestModel, err error)
	GetLatestPostList(ctx context.Context, lastId int64, limit int32) (ret []*model.PostLatestModel, err error)
}

PostLatestRepo define a repo interface

func NewPostLatest

func NewPostLatest(db *gorm.DB) PostLatestRepo

NewPostLatest new a repository and return

type UserCommentRepo

type UserCommentRepo interface {
	CreateUserComment(ctx context.Context, db *gorm.DB, data *model.UserCommentModel) (id int64, err error)
	UpdateUserComment(ctx context.Context, id int64, data *model.UserCommentModel) error
	GetUserComment(ctx context.Context, id int64) (ret *model.UserCommentModel, err error)
	BatchGetUserComment(ctx context.Context, ids []int64) (ret []*model.UserCommentModel, err error)
}

UserCommentRepo define a repo interface

func NewUserComment

func NewUserComment(db *gorm.DB, cache cache.UserCommentCache) UserCommentRepo

NewUserComment new a repository and return

type UserLikeRepo

type UserLikeRepo interface {
	CreateUserLike(ctx context.Context, db *gorm.DB, data *model.UserLikeModel) (id int64, err error)
	UpdateUserLike(ctx context.Context, id int64, data *model.UserLikeModel) error
	GetUserLike(ctx context.Context, userID, objID int64, objType int32) (ret *model.UserLikeModel, err error)
	BatchGetUserLike(ctx context.Context, userId int64, objType int32, ids []int64) (ret []*model.UserLikeModel, err error)
	ListUserLikeByObj(ctx context.Context, objType int32, objID, lastID int64, limit int32) (ret []*model.UserLikeModel, err error)
}

UserLikeRepo define a repo interface

func NewUserLike

func NewUserLike(db *gorm.DB, cache cache.UserLikeCache) UserLikeRepo

NewUserLike new a repository and return

type UserPostRepo

type UserPostRepo interface {
	CreateUserPost(ctx context.Context, db *gorm.DB, data *model.UserPostModel) (id int64, err error)
	UpdateUserPost(ctx context.Context, id int64, data *model.UserPostModel) error
	UpdateDelFlag(ctx context.Context, db *gorm.DB, id int64, delFlag int) error
	GetUserPost(ctx context.Context, id int64) (ret *model.UserPostModel, err error)
	BatchGetUserPost(ctx context.Context, ids []int64) (ret []*model.UserPostModel, err error)
	GetUserPostByUserId(ctx context.Context, userId int64, lastId int64, limit int32) (ret []*model.UserPostModel, err error)
}

UserPostRepo define a repo interface

func NewUserPost

func NewUserPost(db *gorm.DB) UserPostRepo

NewUserPost new a repository and return

Jump to

Keyboard shortcuts

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