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:
commit
a366feb01d
3 changed files with 42 additions and 26 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue