entc/gen: allow package with alias on ID field (#2926)

* entc/gen: allow package with alias on ID field

* Update entc/gen/template/import.tmpl

Co-authored-by: Giau. Tran Minh <giau.tmg@gmail.com>

Co-authored-by: Giau. Tran Minh <giau.tmg@gmail.com>
This commit is contained in:
Pedro Henrique
2022-09-18 10:45:21 -03:00
committed by GitHub
parent b81db910a3
commit 1f8e4ada01
22 changed files with 2397 additions and 17 deletions

View File

@@ -19,7 +19,8 @@ import (
"{{ $.Config.Package }}/predicate"
{{- if $.HasOneFieldID }}
{{- with $.ID.Type.PkgPath }}
"{{ . }}"
{{- $name := $.ID.Type.PkgName }}
{{ if ne $name (base $.ID.Type.PkgPath) }}{{ $name }} {{ end}}"{{ . }}"
{{- end }}
{{- end }}
{{- /* Import external packages */}}