Field helpers generated by GORM cli, donot have the base model defined in a seperated file.
type:missing reproduction steps
I define a struct named BaseModel in a seperated file named base_model.go, the struction
type BaseModel struct {
ID uint64
TenantID uint64
Status string
CreatedAt time.Time
UpdatedAt time.Time
}
Then, I define a User model embeding it in user.go .
type User struct {
BaseModel
Username string
Remark string
}
The field helper generated is
var User = struct {
Username field.String
Remark field.String
}{
Username: field.String{}.WithColumn("username"),
Remark: field.String{}.WithColumn("remark"),
}
And I use config as the demo shows, but it cannot generate a right result.
var _ = genconfig.Config{
ExcludeStructs: []any{BaseModel{}},
}
It's not my exception. But when I put BaseModel and user in the same file, it can generate a right helper.
My computer : windows11 with an arm cpu.
Please help me.
0 条评论