wp-go/app/pkg/models/wp_comments.go

37 lines
2.1 KiB
Go
Raw Permalink Normal View History

2023-01-12 12:42:16 +00:00
package models
2022-08-27 13:21:05 +00:00
import "time"
2022-11-05 14:40:02 +00:00
type Comments struct {
2022-08-27 13:21:05 +00:00
CommentId uint64 `gorm:"column:comment_ID" db:"comment_ID" json:"comment_ID" form:"comment_ID"`
CommentPostId uint64 `gorm:"column:comment_post_ID" db:"comment_post_ID" json:"comment_post_ID" form:"comment_post_ID"`
CommentAuthor string `gorm:"column:comment_author" db:"comment_author" json:"comment_author" form:"comment_author"`
CommentAuthorEmail string `gorm:"column:comment_author_email" db:"comment_author_email" json:"comment_author_email" form:"comment_author_email"`
CommentAuthorUrl string `gorm:"column:comment_author_url" db:"comment_author_url" json:"comment_author_url" form:"comment_author_url"`
CommentAuthorIp string `gorm:"column:comment_author_IP" db:"comment_author_IP" json:"comment_author_IP" form:"comment_author_IP"`
CommentDate time.Time `gorm:"column:comment_date" db:"comment_date" json:"comment_date" form:"comment_date"`
CommentDateGmt time.Time `gorm:"column:comment_date_gmt" db:"comment_date_gmt" json:"comment_date_gmt" form:"comment_date_gmt"`
CommentContent string `gorm:"column:comment_content" db:"comment_content" json:"comment_content" form:"comment_content"`
CommentKarma int `gorm:"column:comment_karma" db:"comment_karma" json:"comment_karma" form:"comment_karma"`
CommentApproved string `gorm:"column:comment_approved" db:"comment_approved" json:"comment_approved" form:"comment_approved"`
CommentAgent string `gorm:"column:comment_agent" db:"comment_agent" json:"comment_agent" form:"comment_agent"`
CommentType string `gorm:"column:comment_type" db:"comment_type" json:"comment_type" form:"comment_type"`
CommentParent uint64 `gorm:"column:comment_parent" db:"comment_parent" json:"comment_parent" form:"comment_parent"`
UserId uint64 `gorm:"column:user_id" db:"user_id" json:"user_id" form:"user_id"`
2022-09-20 13:16:51 +00:00
//扩展字段
PostTitle string `db:"post_title"`
2022-08-27 13:21:05 +00:00
}
2022-11-05 14:40:02 +00:00
func (w Comments) PrimaryKey() string {
2022-08-27 13:21:05 +00:00
return "comment_ID"
}
2022-11-05 14:40:02 +00:00
func (w Comments) Table() string {
2022-08-27 13:21:05 +00:00
return "wp_comments"
}
type PostComments struct {
Comments
Children []uint64
}