Documentation ¶
Index ¶
- Constants
- func Init() error
- type Comment
- type CommentDao
- func (c *CommentDao) CreateComment(userId, videoId int64, commentText string) (int64, error)
- func (c *CommentDao) DeleteComment(commentId, videoId int64) error
- func (c *CommentDao) QueryCommentById(commentId int64) (*Comment, error)
- func (c *CommentDao) QueryCommentsByVideoId(videoId int64) ([]Comment, error)
- type Favorite
- type FavoriteDao
- func (f *FavoriteDao) CreateFavorite(userId int64, videoId int64, actionType int32) error
- func (f *FavoriteDao) QueryActionTypeByUserIdAndVideoId(userId, videoId int64) (int32, error)
- func (f *FavoriteDao) QueryFavoriteByUserIdAndVideoId(userId int64, videoId int64) (bool, error)
- func (f *FavoriteDao) QueryFavoriteCountByUserId(userId int64) (int64, error)
- func (f *FavoriteDao) QueryVideosIdByUserId(userId int64) ([]int64, error)
- func (f *FavoriteDao) UpdateFavorite(userId int64, videoId int64, actionType int32) error
- type Relation
- type RelationDao
- func (r *RelationDao) CreateRelation(userId, toUserId int64) error
- func (r *RelationDao) DeleteRelation(userId, toUserId int64) error
- func (r *RelationDao) QueryFollowIdsByUserId(userId int64) ([]int64, error)
- func (r *RelationDao) QueryFollowerIdsByUserId(userId int64) ([]int64, error)
- func (r *RelationDao) QueryIsFollowByUserIdAndToUserId(userId, toUserId int64) (bool, error)
- type User
- type UserDao
- func (u *UserDao) CreateByNameAndPassword(name, password string) (*User, error)
- func (u *UserDao) QueryIsContainsUserName(name string) (bool, error)
- func (u *UserDao) QueryLoginInfo(name string) (*User, error)
- func (u *UserDao) QueryUserById(userId int64) (*User, error)
- func (u *UserDao) QueryUsersByIds(ids []int64) ([]User, error)
- type Video
- type VideoDao
- func (d *VideoDao) CreateVideoRecord(userId int64, playURL string, coverURL string, title string) error
- func (d *VideoDao) QueryByIds(ids []int64) ([]Video, error)
- func (d *VideoDao) QueryByOwner(ownerId int64) ([]Video, error)
- func (d *VideoDao) QueryFeedFlow(latestTime string) ([]Video, error)
- func (d *VideoDao) QueryPublishCountByUserId(userId int64) (int64, error)
- func (d *VideoDao) QueryTotalFavoriteCountByUserId(userId int64) (int64, error)
Constants ¶
const MaxListLength = 30
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentDao ¶
type CommentDao struct { }
func NewCommentDaoInstance ¶
func NewCommentDaoInstance() *CommentDao
NewCommentDaoInstance 返回一个评论表实体类的指针变量,可以方便调用该结构体的方法
func (*CommentDao) CreateComment ¶
func (c *CommentDao) CreateComment(userId, videoId int64, commentText string) (int64, error)
CreateComment 新增评论返回评论id
func (*CommentDao) DeleteComment ¶
func (c *CommentDao) DeleteComment(commentId, videoId int64) error
DeleteComment 删除评论
func (*CommentDao) QueryCommentById ¶
func (c *CommentDao) QueryCommentById(commentId int64) (*Comment, error)
QueryCommentById 通过id查询评论
func (*CommentDao) QueryCommentsByVideoId ¶
func (c *CommentDao) QueryCommentsByVideoId(videoId int64) ([]Comment, error)
QueryCommentsByVideoId 通过视频id查询该视频所有评论
type FavoriteDao ¶
type FavoriteDao struct { }
func NewFavoriteDaoInstance ¶
func NewFavoriteDaoInstance() *FavoriteDao
NewFavoriteDaoInstance 返回一个点赞表实体类的指针变量,可以方便调用该结构体的方法
func (*FavoriteDao) CreateFavorite ¶
func (f *FavoriteDao) CreateFavorite(userId int64, videoId int64, actionType int32) error
CreateFavorite 创建点赞关联记录
func (*FavoriteDao) QueryActionTypeByUserIdAndVideoId ¶
func (f *FavoriteDao) QueryActionTypeByUserIdAndVideoId(userId, videoId int64) (int32, error)
QueryActionTypeByUserIdAndVideoId 通过用户id和视频id获取该用户对于这个视频是否点赞的状态码
func (*FavoriteDao) QueryFavoriteByUserIdAndVideoId ¶
func (f *FavoriteDao) QueryFavoriteByUserIdAndVideoId(userId int64, videoId int64) (bool, error)
QueryFavoriteByUserIdAndVideoId 查询是否包含对应点赞关联记录
func (*FavoriteDao) QueryFavoriteCountByUserId ¶
func (f *FavoriteDao) QueryFavoriteCountByUserId(userId int64) (int64, error)
QueryFavoriteCountByUserId 根据用户id查询用户点赞视频的数量
func (*FavoriteDao) QueryVideosIdByUserId ¶
func (f *FavoriteDao) QueryVideosIdByUserId(userId int64) ([]int64, error)
QueryVideosIdByUserId 通过用户id查询查询该用户点赞的所有视频对应的视频id列表
func (*FavoriteDao) UpdateFavorite ¶
func (f *FavoriteDao) UpdateFavorite(userId int64, videoId int64, actionType int32) error
UpdateFavorite 更新点赞关联记录
type RelationDao ¶
type RelationDao struct { }
func NewRelationDaoInstance ¶
func NewRelationDaoInstance() *RelationDao
NewRelationDaoInstance 返回一个评论表实体类的指针变量,可以方便调用该结构体的方法
func (*RelationDao) CreateRelation ¶
func (r *RelationDao) CreateRelation(userId, toUserId int64) error
CreateRelation 新增关注记录信息
func (*RelationDao) DeleteRelation ¶
func (r *RelationDao) DeleteRelation(userId, toUserId int64) error
DeleteRelation 删除关注记录信息
func (*RelationDao) QueryFollowIdsByUserId ¶
func (r *RelationDao) QueryFollowIdsByUserId(userId int64) ([]int64, error)
QueryFollowIdsByUserId 通过用户id查询该用户关注的所有用户的id
func (*RelationDao) QueryFollowerIdsByUserId ¶
func (r *RelationDao) QueryFollowerIdsByUserId(userId int64) ([]int64, error)
QueryFollowerIdsByUserId 通过用户id查询该用户所有粉丝的用户id
func (*RelationDao) QueryIsFollowByUserIdAndToUserId ¶
func (r *RelationDao) QueryIsFollowByUserIdAndToUserId(userId, toUserId int64) (bool, error)
QueryIsFollowByUserIdAndToUserId 通过登录用户id和视频发布者id获取该登录用户是否关注视频所有者
type User ¶
type User struct { Id int64 `gorm:"primary_key"` Name string `gorm:"column:name;size:32;not null"` Password string `gorm:"column:password;size:32;"` FollowCount int64 `gorm:"column:follow_count"` FollowerCount int64 `gorm:"column:follower_count"` Avatar string Signature string BackgroundImage string }
type UserDao ¶
type UserDao struct { }
func NewUserDaoInstance ¶
func NewUserDaoInstance() *UserDao
NewUserDaoInstance 返回一个用户实体类的指针变量,可以方便调用该结构体的方法
func (*UserDao) CreateByNameAndPassword ¶
CreateByNameAndPassword 通过用户名和密码创建新用户
func (*UserDao) QueryIsContainsUserName ¶
QueryIsContainsUserName 查询用户名是否存在
func (*UserDao) QueryLoginInfo ¶
QueryLoginInfo 通过用户名查询此用户信息
func (*UserDao) QueryUserById ¶
QueryUserById 通过用户id查询详细的用户信息
type Video ¶
type Video struct { Id int64 `gorm:"primaryKey"` PlayUrl string `gorm:"size:64"` CoverUrl string `gorm:"size:64"` FavoriteCount int64 `gorm:"column:favorite_count"` CommentCount int64 `gorm:"column:comment_count"` Title string `gorm:"column:title;size:32"` UserId int64 `gorm:"column:user_id"` CreateTime time.Time `gorm:"default:CURRENT_TIMESTAMP"` }
type VideoDao ¶
type VideoDao struct { }
func NewVideoDaoInstance ¶
func NewVideoDaoInstance() *VideoDao
NewVideoDaoInstance 返回一个视频实体类的指针变量,可以方便调用该结构体的方法
func (*VideoDao) CreateVideoRecord ¶
func (d *VideoDao) CreateVideoRecord(userId int64, playURL string, coverURL string, title string) error
CreateVideoRecord 通过传入参数创建新的视频记录
func (*VideoDao) QueryByIds ¶
QueryByIds 通过一组视频id获取对应的视频列表
func (*VideoDao) QueryByOwner ¶
QueryByOwner 通过用户id查询该用户发布的所有视频
func (*VideoDao) QueryFeedFlow ¶
QueryFeedFlow 通过当前时间查询这个时间前新发布的50条视频,逆序输出
func (*VideoDao) QueryPublishCountByUserId ¶
QueryPublishCountByUserId 通过用户id查询该用户发布的视频数量