This commit is contained in:
2021-02-04 15:31:07 -05:00
parent 082f923482
commit a5692babb8
20 changed files with 319 additions and 348 deletions

View File

@@ -42,7 +42,7 @@ type Field struct {
Name string
Type types.Type
Tag string
Gorm string
Gorm string
}
type Enum struct {
@@ -163,21 +163,21 @@ func (m *Plugin) MutateConfig(cfg *config.Config) error {
typ = types.NewPointer(typ)
}
gormType := ""
directive := field.Directives.ForName("meta")
if directive != nil {
arg := directive.Arguments.ForName("gorm")
if arg != nil {
gormType = fmt.Sprintf("gorm:\"%s\"", arg.Value.Raw)
}
}
gormType := ""
directive := field.Directives.ForName("meta")
if directive != nil {
arg := directive.Arguments.ForName("gorm")
if arg != nil {
gormType = fmt.Sprintf("gorm:\"%s\"", arg.Value.Raw)
}
}
it.Fields = append(it.Fields, &Field{
Name: name,
Type: typ,
Description: field.Description,
Tag: `json:"` + field.Name + `"`,
Gorm: gormType,
Gorm: gormType,
})
}