Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMigrate ¶
func GetMigrate() []any
func ViewedFilter ¶
Types ¶
type Comment ¶
type Comment struct {
Model
UserID int64 `json:"-" gorm:"index:idx_uvid;comment:评论用户信息"`
VideoID int64 `json:"-" gorm:"index:idx_uvid;comment:评论视频信息"`
User User `json:"user" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Video *Video `json:"video,omitempty" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Content string `json:"content" gorm:"comment:评论内容"`
CreateDate string `json:"create_date" gorm:"comment:评论发布日期"` // 格式 mm-dd
// 自建字段
ReplyID int64 `json:"reply_id" gorm:"index;comment:回复ID"`
}
Comment 评论表
type FriendUser ¶
type FriendUser struct {
User
Message string `json:"message"` // 和该好友的最新聊天消息
MsgType int `json:"msg_type"` // 0 => 当前请求用户接收的消息, 1 => 当前请求用户发送的消息
}
FriendUser 好友结构体
type Message ¶
type Message struct {
ID int64 `json:"id" gorm:"primarykey;comment:主键"`
CreatedAt int64 `json:"create_time" gorm:"autoUpdateTime:milli"`
ToUserID int64 `json:"to_user_id,string" gorm:"primaryKey;comment:该消息接收者的id"`
FromUserID int64 `json:"from_user_id,string" gorm:"primaryKey;comment:该消息发送者的id"`
ToUser User `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
FromUser User `json:"-" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Content string `json:"content" gorm:"comment:消息内容"`
}
Message 消息表
type Model ¶
type User ¶
type User struct {
Model
Name string `json:"name" gorm:"index:,unique;size:32;comment:用户名称"`
Pawd string `json:"-" gorm:"size:128;comment:用户密码"`
Avatar string `json:"avatar" gorm:"comment:用户头像"`
BackgroundImage string `json:"background_image" gorm:"comment:用户个人页顶部大图"`
Signature string `json:"signature" gorm:"default:此人巨懒;comment:个人简介"`
WorkCount int64 `json:"work_count" gorm:"default:0;comment:作品数量"`
Follow []*User `json:"follow,omitempty" gorm:"many2many:UserFollow;comment:关注列表"`
Favorite []*Video `json:"like_list,omitempty" gorm:"many2many:UserFavorite;comment:喜欢列表"`
Videos []*Video `json:"video_list,omitempty" gorm:"many2many:UserCreation;comment:作品列表"`
Comment []*Comment `json:"comment_list,omitempty" gorm:"comment:评论列表"`
FollowCount int64 `json:"follow_count" gorm:"-"` // 关注总数
FollowerCount int64 `json:"follower_count" gorm:"-"` // 粉丝总数
TotalFavorited int64 `json:"total_favorited" gorm:"-"` // 获赞数量
FavoriteCount int64 `json:"favorite_count" gorm:"-"` // 点赞数量
IsFollow bool `json:"is_follow" gorm:"-"` // 是否关注
Follower []*User `json:"follower,omitempty" gorm:"-"` // 粉丝列表
Friend []*User `json:"friend,omitempty" gorm:"-"` // 好友列表
}
User 用户信息表
func (*User) HIncrByFollowCount ¶
func (*User) HIncrByFollowerCount ¶
type UserCreation ¶
type UserCreation struct {
VideoID int64 `json:"video_id,omitempty" gorm:"primaryKey"`
UserID int64 `json:"author_id" gorm:"primaryKey"`
Type string `json:"type" gorm:"comment:创作者类型"` // Up主, 参演,剪辑,录像,道具,编剧,打酱油
CreatedAt time.Time `json:"created_at"`
DeletedAt gorm.DeletedAt `json:"-"`
}
UserCreation 联合作者
type Video ¶
type Video struct {
Model
AuthorID int64 `json:"-" gorm:"index;notNull;comment:视频作者信息"`
Author User `json:"author"`
PlayUrl string `json:"play_url" gorm:"comment:视频播放地址"`
CoverUrl string `json:"cover_url" gorm:"comment:视频封面地址"`
Title string `json:"title" gorm:"comment:视频标题"`
Desc string `json:"desc" gorm:"comment:简介"`
Comment []*Comment `json:"comment,omitempty" gorm:"comment:评论列表"`
FavoriteUser []*User `json:"-" gorm:"many2many:UserFavorite;comment:喜欢用户列表"`
IsFavorite bool `json:"is_favorite" gorm:"-"` // 是否点赞
PlayCount int64 `json:"play_count" gorm:"-"` // 视频播放量
FavoriteCount int64 `json:"favorite_count" gorm:"-"` // 视频的点赞总数
CommentCount int64 `json:"comment_count" gorm:"-"` // 视频的评论总数
// 自建字段
TypeOf string `json:"typeOf" gorm:"comment:视频类型"`
CoAuthor []*User `json:"authors,omitempty" gorm:"many2many:UserCreation;"` // 联合投稿
}
Video 视频表
func (*Video) HIncrByCommentCount ¶
func (*Video) HIncrByFavoriteCount ¶
Click to show internal directories.
Click to hide internal directories.