/
comment.go
25 lines (21 loc) · 1.28 KB
/
comment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package model
import (
"github.com/zhufuyi/sponge/pkg/mysql"
)
// Comment 评论详情
type Comment struct {
mysql.Model `gorm:"embedded"` // embed id and time
PostID uint64 `gorm:"column:post_id;type:bigint(20) unsigned;NOT NULL" json:"postId"` // 帖子id
Type int `gorm:"column:type;type:tinyint(4);NOT NULL" json:"type"` // 类型:0:未知, 1:文本, 2:图片, 3:视频
UserID uint64 `gorm:"column:user_id;type:bigint(20) unsigned;NOT NULL" json:"userId"` // 用户id
ParentID uint64 `gorm:"column:parent_id;type:bigint(20) unsigned;NOT NULL" json:"parentId"` // 父评论id
ReplyCount uint `gorm:"column:reply_count;type:int(10) unsigned;NOT NULL" json:"replyCount"` // 回复数
LikeCount uint `gorm:"column:like_count;type:int(10) unsigned;NOT NULL" json:"likeCount"` // 点赞数
Score int `gorm:"column:score;type:tinyint(4);NOT NULL" json:"score"` // 分数
ToUid uint64 `gorm:"column:to_uid;type:bigint(20) unsigned;NOT NULL" json:"toUid"` // 给id
DelFlag int `gorm:"column:del_flag;type:tinyint(4);NOT NULL" json:"delFlag"` // 删除方式,0:正常, 1:用户删除, 2:管理员删除
}
// TableName table name
func (m *Comment) TableName() string {
return "comment"
}