entc/gen: fix eager loading when using uuid for foreign keys failing if loading more than a single relation (#533)

* Bugfix: eager lodaing when using uuid for foreign keys failing if loading more than a single relation (#532)

* go generate ./... output
This commit is contained in:
Joel Courtney
2020-06-09 15:10:14 +10:00
committed by GitHub
parent 737fb4afda
commit e4d57a47f7
2 changed files with 4 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error {
{{- range $i, $fk := . }}
{{- $f := $fk.Field }}
{{- if and $f.UserDefined (or $f.IsString $f.IsUUID) }}
{{- with extend $ "Idx" 0 "Field" $f "Rec" $receiver "StructField" $f.Name }}
{{- with extend $ "Idx" $i "Field" $f "Rec" $receiver "StructField" $f.Name }}
{{ template "dialect/sql/decode/field" . }}
{{- end }}
{{- else }}
@@ -118,4 +118,4 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error {
{{- $f := $fk.Field }}
{{ $f.Name }} {{ if $f.Nillable }}*{{ end }}{{ $f.Type }}
{{- end }}
{{ end }}
{{ end }}