gen
gen copied to clipboard
如何设置自定义类型与gen类型的对应
如何设置自定义类型与gen类型的对应
The document you expected this should be explained
我又一个自定义类型
type MyTime struct {
time.Time
}
然后再模型中引用:
type MyModel {
gorm.Model
SubmittedAt *MyTime `gorm:"column:submitted;type:datetime(6)" json:"submitted_at"` // 提交时间
}
然后生成
g.ApplyBasic(MyModel{})
Expected answer
字段 SubmittedAt 的类型 为 field.Field ,我想让其为 field.Time 怎么设置呢?