entc/gen: allow if field to use field.Other with custom types (#2309)

* fix ID with field.Other comparing with zero

* fix lint

* Update entc/integration/customid/ent/schema/other.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* re-generate code

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
This commit is contained in:
Pedro Henrique
2022-02-10 11:17:16 -03:00
committed by GitHub
parent e84c3d33fe
commit f45d29ba4b
22 changed files with 2554 additions and 8 deletions

View File

@@ -51,7 +51,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(columns []string, values []int
for {{ $idx }} := range columns {
switch columns[{{ $idx }}] {
case {{ $.Package }}.{{ $.ID.Constant }}:
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID $.ID.IsBytes) }}
{{- if and $.ID.UserDefined (or $.ID.IsString $.ID.IsUUID $.ID.IsBytes $.ID.IsOther) }}
{{- with extend $ "Idx" $idx "Field" $.ID "Rec" $receiver }}
{{ template "dialect/sql/decode/field" . }}
{{- end }}