service

package
v0.0.0-...-dcbaf51 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelFavorite

func CancelFavorite(ctx context.Context, uid, vid int64) error

func CancelFollow

func CancelFollow(ctx context.Context, uid, targetID int64) error

func CreateComment

func CreateComment(ctx context.Context, uid, vid int64, content string) error

func CreateVideo

func CreateVideo(ctx context.Context, uid int64, video model.Video) error

CreateVideo create a single video

func DeleteComment

func DeleteComment(ctx context.Context, uid, cid int64) error

func Favorite

func Favorite(ctx context.Context, uid, vid int64) error

func FillVideoList

func FillVideoList(ctx context.Context, curID int64, videos []dao.Video, user *model.User, res *FeedResponse) error

FillVideoList 对mysql数据库的查出来的video信息进行填充:Author,id,FavoriteCount,CommentCount 传入user的目的是判断调用的接口方是否是查询个人的,如果是个人直接填充

func Follow

func Follow(ctx context.Context, uid, targetID int64) error

func IsUserExist

func IsUserExist(ctx context.Context, username string) (bool, error)

IsUserExist 判断用户名是否存在

func Login

func Login(ctx context.Context, name string, password string) (*model.UserLoginResponse, error)

Login 登录流程

func MGetVideosByUIDNoCache

func MGetVideosByUIDNoCache(ctx context.Context, uid, targetID int64, res *FeedResponse) error

MGetVideosByUIDNoCache 个人视频中没有缓存的情况:从mysql取出来,并进行缓存

func MGetVideosNoCache

func MGetVideosNoCache(ctx context.Context, curID, nextTime int64, res *FeedResponse) error

MGetVideosNoCache 没有缓存的情况:从Mysql数据库中获取全部的视频流信息 -> 存入redis缓存

func QueryFollowInfo

func QueryFollowInfo(ctx context.Context, user *model.User, curID, targetID int64)

func QueryUser

func QueryUser(ctx context.Context, curID, targetID int64) (*model.User, error)

QueryUser 查询目标用户的信息,curId传进来只是为了判断目标用户与当前用户的关系(isFollow)

func Register

func Register(ctx context.Context, name string, password string) (*model.UserLoginResponse, error)

Register 注册流程

Types

type CommentListResponse

type CommentListResponse struct {
	app.Response
	CommentList []model.Comment `json:"comment_list,omitempty"`
}

func MGetComments

func MGetComments(ctx context.Context, uid, vid int64) (*CommentListResponse, error)

type FeedResponse

type FeedResponse struct {
	app.Response
	VideoList []model.Video `json:"video_list,omitempty"`
	NextTime  int64         `json:"next_time,omitempty"`
}

func MGetVideos

func MGetVideos(ctx context.Context, curID, nextTime int64) (*FeedResponse, error)

MGetVideos 返回视频列表 根据目前我们这个业务场景来讲取视频一次取30个,并且视频发布不是很频繁的情况下, 考虑在第一次查询的时候直接搞30分钟的cache,如果cache不存在的情况下,进行Mysql的读取

func MGetVideosByUID

func MGetVideosByUID(ctx context.Context, uid, targetID int64) (*FeedResponse, error)

MGetVideosByUID 获取某一用户的所有视频列表,同样是判断个人投稿的缓存是否存在 -> 如果没缓存去mysql中寻找

type UserListResponse

type UserListResponse struct {
	app.Response
	UserList []model.User `json:"user_list"`
}

func GetFollowOrFans

func GetFollowOrFans(ctx context.Context, key string, uid, targetID int64) (*UserListResponse, error)

type VideoListResponse

type VideoListResponse struct {
	app.Response
	VideoList []model.Video `json:"video_list"`
}

func GetFavoriteList

func GetFavoriteList(ctx context.Context, uid, targetID int64) (*VideoListResponse, error)

Jump to

Keyboard shortcuts

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