gen icon indicating copy to clipboard operation
gen copied to clipboard

如何设置自定义类型与gen类型的对应

Open goodking-bq opened this issue 2 years ago • 0 comments

如何设置自定义类型与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 怎么设置呢?

goodking-bq avatar Aug 09 '22 04:08 goodking-bq