mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: support valuescanner in go-types (#510)
This commit is contained in:
@@ -93,7 +93,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error {
|
||||
{{- $nulltype := $f.NullType -}}
|
||||
if value, ok := values[{{ $i }}].(*{{ $nulltype }}); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field {{ $f.Name }}", values[{{ $i }}])
|
||||
{{- if hasPrefix $nulltype "sql" }}
|
||||
{{- if and (not $f.Type.ValueScanner) (hasPrefix $nulltype "sql") }}
|
||||
} else if value.Valid {
|
||||
{{- if $f.Nillable }}
|
||||
{{ $ret }}.{{ $field }} = new({{ $f.Type }})
|
||||
|
||||
Reference in New Issue
Block a user