mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
entc/gen: wrap nillable fields with custom go-type with sql.nullscanner
This commit is contained in:
committed by
Ariel Mashraki
parent
762e6aeff9
commit
2480b5c0ef
@@ -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)
|
||||
|
||||
@@ -400,7 +400,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)
|
||||
|
||||
@@ -399,7 +399,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
s.Where(sql.InValues(user.FriendsPrimaryKey[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)
|
||||
|
||||
@@ -435,7 +435,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
s.Where(sql.InValues(user.FollowersPrimaryKey[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)
|
||||
@@ -500,7 +500,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
s.Where(sql.InValues(user.FollowingPrimaryKey[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)
|
||||
|
||||
@@ -480,7 +480,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) {
|
||||
s.Where(sql.InValues(group.UsersPrimaryKey[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)
|
||||
|
||||
@@ -106,7 +106,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error {
|
||||
u.Name = value.String
|
||||
}
|
||||
case user.FieldFoods:
|
||||
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field foods", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
|
||||
@@ -480,7 +480,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
s.Where(sql.InValues(user.GroupsPrimaryKey[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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -444,7 +444,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)
|
||||
|
||||
@@ -444,7 +444,7 @@ func (pq *PetQuery) sqlAll(ctx context.Context) ([]*Pet, error) {
|
||||
s.Where(sql.InValues(pet.FriendsPrimaryKey[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)
|
||||
|
||||
@@ -538,7 +538,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
|
||||
s.Where(sql.InValues(user.FriendsPrimaryKey[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)
|
||||
@@ -603,7 +603,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)
|
||||
|
||||
Reference in New Issue
Block a user