-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.go
30 lines (27 loc) · 1.06 KB
/
post.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
26
27
28
29
30
package models
import "time"
type Post struct {
ID int64 `json:"id" gorm:"column:post_id"`
AuthorID int64 `json:"author_id" gorm:"column:author_id"`
CommunityID int64 `json:"community_id" gorm:"column:community_id;not null"`
Status int32 `json:"status" gorm:"column:status"`
Title string `json:"title" gorm:"column:title;not null"`
Content string `json:"content" gorm:"column:content;not null"`
CreateTime time.Time `json:"-" gorm:"column:create_time;autoCreateTime"`
UpdatedTime time.Time `json:"-" gorm:"column:updated_time;autoUpdateTime"`
Community Community `json:"-" gorm:"foreignKey:CommunityID"`
User User `json:"-" gorm:"foreignKey:AuthorID"`
}
// 帖子详情结构的结构体 设置api接口专用的模型
type ApiPostDetail struct {
AuthorName string `json:"author_name"`
//VoteNum int64 `json:"vote_num"`
*Post
*Community `json:"community"`
}
type ApiPostDetail2 struct {
AuthorName string `json:"author_name"`
VoteNum int64 `json:"vote_num"`
*Post
*Community `json:"community"`
}