修复结构体 tag 字段的错误使用

结构体的 tag 字段的多个 key-value 对需要使用空格分隔,否则会有以下警告:
struct field tag `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;"swaggertype:"array,object"` not compatible with reflect.StructTag.Get: key:"value" pairs not separated by spaces
This commit is contained in:
huiyifyj 2024-12-16 21:55:44 +08:00
parent 2cd76c752f
commit fe6830b77a
No known key found for this signature in database
GPG Key ID: 67D4F264AF9D2C4C
1 changed files with 4 additions and 4 deletions

View File

@ -8,10 +8,10 @@ import (
// Info 公告 结构体
type Info struct {
global.GVA_MODEL
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;"swaggertype:"array,object"` //附件
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;" swaggertype:"array,object"` //附件
}
// TableName 公告 Info自定义表名 gva_announcements_info