Merge pull request #476 from markvai/fix-custom-type-parameter-gen

Add a field for additional imports when using generic types
This commit is contained in:
go-jet 2025-04-02 12:36:47 +02:00 committed by GitHub
commit a366feb01d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 26 deletions

View file

@ -106,10 +106,10 @@ func getTableModelImports(modelType TableModel, tableMetaData metadata.Table) []
importPaths := map[string]bool{}
for _, columnMetaData := range tableMetaData.Columns {
field := modelType.Field(columnMetaData)
importPath := field.Type.ImportPath
if importPath != "" {
importPaths[importPath] = true
for _, importPath := range append([]string{field.Type.ImportPath}, field.Type.AdditionalImportPaths...) {
if importPath != "" {
importPaths[importPath] = true
}
}
}
@ -207,8 +207,9 @@ func (f TableModelField) TagsString() string {
// Type represents type of the struct field
type Type struct {
ImportPath string
Name string
ImportPath string
AdditionalImportPaths []string
Name string
}
// NewType creates new type for dummy object