Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;not null"` Content string `gorm:"not null"` UserID int64 `gorm:"not null"` //评论者的id VideoID int64 `gorm:"not null;index"` //被评论视频的id UpdateTime int64 `gorm:"not null;index"` //评论的发布、更新时间 }
Comment:视频评论
type User ¶
type User struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;not null"` Username string Password_Hash string // 加密后的密码 //用户关注列表,多对多,gorm自动生成一个中间表 Follows []*User `gorm:"many2many:user_follows;association_jointable_foreignkey:follow_id"` //该用户的关注 //粉丝列表,多对多,同样自动生成一个中间表 Followers []*User `gorm:"many2many:user_followers;association_jointable_foreignkey:follower_id"` //该用户的粉丝 //用户发布的视频,通过视频表的作者id作为外键关联 Videos []Video `gorm:"foreignkey:AuthorID"` //该用户发布的作品 //用户点赞过的视频,多对多,生成一个中间表, FavoriteVideos []Video `gorm:"many2many:user_favorite;association_jointable_foreignkey:favorite_id"` //用户点赞过的作品 }
User:用户信息
type Video ¶
type Video struct { ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;not null"` Title string `gorm:"not null"` AuthorID int64 `gorm:"not null;index"` //作者id UpdateTime int64 `gorm:"not null;index"` //发布、更新时间 Location string `gorm:"not null"` //储存位置 Cover_location string `gorm:"not null"` //封面储存位置 // PlayLocation string //视频播放地址 //视频评论,通过评论表的视频id作为外键关联 Comments []Comment `gorm:"foreignkey:VideoID"` //视频的评论 }
Video:视频信息
Click to show internal directories.
Click to hide internal directories.