41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"SciencesServer/utils"
|
|
"time"
|
|
)
|
|
|
|
// TechnologyPaper 科技论文数据模型
|
|
type TechnologyPaper struct {
|
|
Model
|
|
Local
|
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
|
Title string `gorm:"column:title;type:varchar(100);default:'';comment:题目" json:"title"`
|
|
Ext string `gorm:"column:ext;type:varchar(30);default:'';comment:引用格式" json:"ext"`
|
|
Author string `gorm:"column:author;type:varchar(100);default:'';comment:作者" json:"author"`
|
|
PublishAt time.Time `gorm:"column:publish_at;type:datetime;not null;comment:出版日期" json:"publish_at"`
|
|
Keyword string `gorm:"column:keyword;type:varchar(100);default:'';comment:关键词" json:"keyword"`
|
|
Tag string `gorm:"column:tags;type:varchar(255);default:'';comment:标签" json:"-"`
|
|
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注" json:"remark"`
|
|
ModelDeleted
|
|
ModelAt
|
|
}
|
|
|
|
func (m *TechnologyPaper) TableName() string {
|
|
return m.NewTableName("technology_paper")
|
|
}
|
|
|
|
func (m *TechnologyPaper) GetTagAttribute() []string {
|
|
tags := make([]string, 0)
|
|
_ = utils.FromJSON(m.Tag, &tags)
|
|
return tags
|
|
}
|
|
|
|
func (m *TechnologyPaper) SetTagAttribute(tags []string) {
|
|
m.Tag = utils.AnyToJSON(tags)
|
|
}
|
|
|
|
func NewTechnologyPaper() *TechnologyPaper {
|
|
return &TechnologyPaper{}
|
|
}
|