zhangqian
2023-11-15 6aceac83950d3f17a1137d984df4b1086bfbd016
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package test
 
// Attachment 结构体
type Attachment struct {
    ID       uint     `gorm:"primarykey"` // 主键ID
    FileName string   `json:"fileName" gorm:"type:varchar(127);comment:文件名"`
    FileUrl  string   `json:"FileUrl" gorm:"type:varchar(255);comment:文件地址"`
    Ext      string   `json:"ext" gorm:"type:varchar(15);comment:文件后缀名"`
    FileType FileType `json:"fileType" gorm:"type:varchar(31);comment:文件类型 pic:图片;thumbnail:缩略图;file:文件"`
}
 
// TableName MaterialAttachment 表名
func (Attachment) TableName() string {
    return "attachment"
}
 
type FileType string
 
const (
    FileType_File      FileType = "file"      //文件
    FileType_Picture   FileType = "picture"   //图片
    FileType_Thumbnail FileType = "thumbnail" //缩略图
)