entities.go 1.3 KB

123456789101112131415161718192021222324252627282930
  1. package entities
  2. import "time"
  3. type Video struct {
  4. Id int64 `form:"id,omitempty"`
  5. AuthorId int64 `form:"author_id"`
  6. PlayUrl string `form:"play_url"`
  7. CoverUrl string `form:"cover_url,omitempty"`
  8. FavoriteCount int64 `form:"favorite_count,omitempty"`
  9. CommentCount int64 `form:"comment_count,omitempty"`
  10. IsFavorite bool `form:"is_favorite,omitempty"`
  11. }
  12. type User struct {
  13. Id int64 `form:"id,omitempty"`
  14. UserId string `form:"user_id,omitempty"`
  15. Password string `form:"password,omitempty"`
  16. Name string `form:"name,omitempty"`
  17. FollowCount int64 `form:"follow_count,omitempty"`
  18. FollowerCount int64 `form:"follower_count,omitempty"`
  19. IsFollow bool `form:"is_follow,omitempty"`
  20. }
  21. type Comment struct {
  22. ID int64 `gorm:"comment:自增主键"`
  23. UserID int64 `gorm:"type:BIGINT;not null;index:idx_user_id;评论用户ID" json:"user_id"`
  24. VideoID int64 `gorm:"type:BIGINT;not null;index:idx_video_id;comment:被评论视频ID" json:"video_id"`
  25. Content string `gorm:"type:varchar(300);not null;comment:评论内容" json:"content"`
  26. CreateTime time.Time `gorm:"type:timestamp;not null;default:current_timestamp()"`
  27. UpdateTime time.Time `gorm:"type:timestamp;not null;default:current_timestamp()"`
  28. }