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 Posts struct {
|
2023-02-06 12:50:25 +00:00
|
|
|
post
|
2022-08-27 13:21:05 +00:00
|
|
|
Id uint64 `gorm:"column:ID" db:"ID" json:"ID" form:"ID"`
|
|
|
|
PostAuthor uint64 `gorm:"column:post_author" db:"post_author" json:"post_author" form:"post_author"`
|
|
|
|
PostDate time.Time `gorm:"column:post_date" db:"post_date" json:"post_date" form:"post_date"`
|
|
|
|
PostDateGmt time.Time `gorm:"column:post_date_gmt" db:"post_date_gmt" json:"post_date_gmt" form:"post_date_gmt"`
|
|
|
|
PostContent string `gorm:"column:post_content" db:"post_content" json:"post_content" form:"post_content"`
|
|
|
|
PostTitle string `gorm:"column:post_title" db:"post_title" json:"post_title" form:"post_title"`
|
|
|
|
PostExcerpt string `gorm:"column:post_excerpt" db:"post_excerpt" json:"post_excerpt" form:"post_excerpt"`
|
|
|
|
PostStatus string `gorm:"column:post_status" db:"post_status" json:"post_status" form:"post_status"`
|
|
|
|
CommentStatus string `gorm:"column:comment_status" db:"comment_status" json:"comment_status" form:"comment_status"`
|
|
|
|
PingStatus string `gorm:"column:ping_status" db:"ping_status" json:"ping_status" form:"ping_status"`
|
|
|
|
PostPassword string `gorm:"column:post_password" db:"post_password" json:"post_password" form:"post_password"`
|
|
|
|
PostName string `gorm:"column:post_name" db:"post_name" json:"post_name" form:"post_name"`
|
|
|
|
ToPing string `gorm:"column:to_ping" db:"to_ping" json:"to_ping" form:"to_ping"`
|
|
|
|
Pinged string `gorm:"column:pinged" db:"pinged" json:"pinged" form:"pinged"`
|
|
|
|
PostModified time.Time `gorm:"column:post_modified" db:"post_modified" json:"post_modified" form:"post_modified"`
|
|
|
|
PostModifiedGmt time.Time `gorm:"column:post_modified_gmt" db:"post_modified_gmt" json:"post_modified_gmt" form:"post_modified_gmt"`
|
|
|
|
PostContentFiltered string `gorm:"column:post_content_filtered" db:"post_content_filtered" json:"post_content_filtered" form:"post_content_filtered"`
|
|
|
|
PostParent uint64 `gorm:"column:post_parent" db:"post_parent" json:"post_parent" form:"post_parent"`
|
|
|
|
Guid string `gorm:"column:guid" db:"guid" json:"guid" form:"guid"`
|
|
|
|
MenuOrder int `gorm:"column:menu_order" db:"menu_order" json:"menu_order" form:"menu_order"`
|
|
|
|
PostType string `gorm:"column:post_type" db:"post_type" json:"post_type" form:"post_type"`
|
|
|
|
PostMimeType string `gorm:"column:post_mime_type" db:"post_mime_type" json:"post_mime_type" form:"post_mime_type"`
|
|
|
|
CommentCount int64 `gorm:"column:comment_count" db:"comment_count" json:"comment_count" form:"comment_count"`
|
2022-09-08 02:54:37 +00:00
|
|
|
|
|
|
|
//扩展字段
|
2023-04-15 16:57:50 +00:00
|
|
|
TermsId uint64 `db:"terms_id" json:"terms_id"`
|
|
|
|
TermIds []uint64 `db:"term_ids" json:"term_ids"`
|
2023-01-14 13:12:26 +00:00
|
|
|
Taxonomy string `db:"taxonomy" json:"taxonomy"`
|
|
|
|
CategoryName string `db:"category_name" json:"category_name"`
|
|
|
|
Categories []string `json:"categories"`
|
|
|
|
Tags []string `json:"tags"`
|
|
|
|
CategoriesHtml string
|
|
|
|
TagsHtml string
|
2023-03-29 13:58:39 +00:00
|
|
|
IsSticky bool
|
2023-01-14 13:12:26 +00:00
|
|
|
Thumbnail PostThumbnail
|
|
|
|
AttachmentMetadata WpAttachmentMetadata
|
2023-05-21 13:30:00 +00:00
|
|
|
Author *Users
|
2023-01-10 12:09:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PostThumbnail struct {
|
2023-01-23 15:42:37 +00:00
|
|
|
Path string
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
Srcset string
|
|
|
|
Sizes string
|
|
|
|
OriginAttachmentData WpAttachmentMetadata
|
2022-08-27 13:21:05 +00:00
|
|
|
}
|
|
|
|
|
2023-02-06 12:50:25 +00:00
|
|
|
type post struct {
|
2022-08-27 13:21:05 +00:00
|
|
|
}
|
2022-09-14 13:30:59 +00:00
|
|
|
|
2023-02-06 12:50:25 +00:00
|
|
|
func (w post) PrimaryKey() string {
|
2022-09-14 13:30:59 +00:00
|
|
|
return "ID"
|
|
|
|
}
|
|
|
|
|
2023-02-06 12:50:25 +00:00
|
|
|
func (w post) Table() string {
|
2022-09-14 13:30:59 +00:00
|
|
|
return "wp_posts"
|
|
|
|
}
|
|
|
|
|
|
|
|
type PostArchive struct {
|
2023-02-06 12:50:25 +00:00
|
|
|
post
|
2022-09-14 13:30:59 +00:00
|
|
|
Year string `db:"year"`
|
|
|
|
Month string `db:"month"`
|
|
|
|
Posts int `db:"posts"`
|
|
|
|
}
|