entc/gen: wrap nillable fields with custom go-type with sql.nullscanner

This commit is contained in:
Ariel Mashraki
2021-04-17 10:06:10 +03:00
committed by Ariel Mashraki
parent 762e6aeff9
commit 2480b5c0ef
41 changed files with 181 additions and 95 deletions

View File

@@ -400,7 +400,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) {
s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...))
},
ScanValues: func() [2]interface{} {
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)}
},
Assign: func(out, in interface{}) error {
eout, ok := out.(*sql.NullInt64)

View File

@@ -466,7 +466,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...))
},
ScanValues: func() [2]interface{} {
return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}}
return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)}
},
Assign: func(out, in interface{}) error {
eout, ok := out.(*sql.NullInt64)