blog/internal/model/blog_articel.go

33 lines
901 B
Go

package model
import (
"encoding/json"
)
type BlogArticle struct {
Id string `json:"id" gorm:"primary_key"`
Title string `json:"title"`
SubTitle string `json:"subTitle"`
Previous string `json:"previous"`
Author string `json:"author"`
Content string `json:"content" gorm:"-"`
ContentType string `json:"contentType"`
Tags string `json:"tags"`
PublishTime int64 `json:"publishTime"`
CreateBy string `json:"createBy"`
CreateTime int64 `json:"createTime"`
UpdateBy string `json:"updateBy"`
UpdateTime int64 `json:"updateTime"`
State string `json:"state"`
Del int `json:"del"`
}
func (article *BlogArticle) MarshalBinary() (data []byte, err error) {
// encoding.BinaryMarshaler
return json.Marshal(article)
}
func (article *BlogArticle) UnmarshalBinary(data []byte) (err error) {
return json.Unmarshal(data, article)
}