entc/gen: remove legacy i2a support for ids (#389)

* entc/gen: remove legacy i2a support for ids

* integ: add customid tests for fk strings
This commit is contained in:
Ariel Mashraki
2020-03-16 18:19:30 +02:00
committed by GitHub
parent 15cbc5c223
commit 65f96b3593
110 changed files with 1911 additions and 1900 deletions

View File

@@ -44,7 +44,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error {
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
{{ $receiver }}.ID = {{ if $.ID.IsString }}strconv.FormatInt(value.Int64, 10){{ else }}{{ $.ID.Type }}(value.Int64){{ end }}
{{ $receiver }}.ID = {{ $.ID.Type }}(value.Int64)
{{- end }}
values = values[1:]
{{- range $i, $f := $.Fields }}
@@ -66,7 +66,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error {
return fmt.Errorf("unexpected type %T for edge-field {{ $f.Name}}", value)
} else if value.Valid {
{{ $receiver }}.{{ $f.Name }} = new({{ $f.Type }})
*{{ $receiver }}.{{ $f.Name }} = {{ if $f.IsString }}strconv.FormatInt(value.Int64, 10){{ else }}{{ $f.Type }}(value.Int64){{ end }}
*{{ $receiver }}.{{ $f.Name }} = {{ $f.Type }}(value.Int64)
}
{{- end }}
{{- end }}