all: gofmt -w -r 'interface{} -> any' (#2874)

This commit is contained in:
Ariel Mashraki
2022-08-19 18:23:04 +03:00
committed by GitHub
parent b6c185a660
commit 2c63d1d70e
619 changed files with 3449 additions and 3449 deletions

View File

@@ -54,8 +54,8 @@ func (e CarEdges) OwnerOrErr() (*User, error) {
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Car) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
func (*Car) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case car.FieldID:
@@ -75,7 +75,7 @@ func (*Car) scanValues(columns []string) ([]interface{}, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Car fields.
func (c *Car) assignValues(columns []string, values []interface{}) error {
func (c *Car) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}

View File

@@ -38,7 +38,7 @@ func IDNEQ(id int) predicate.Car {
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.Car {
return predicate.Car(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -49,7 +49,7 @@ func IDIn(ids ...int) predicate.Car {
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.Car {
return predicate.Car(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -115,7 +115,7 @@ func ModelNEQ(v string) predicate.Car {
// ModelIn applies the In predicate on the "model" field.
func ModelIn(vs ...string) predicate.Car {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -126,7 +126,7 @@ func ModelIn(vs ...string) predicate.Car {
// ModelNotIn applies the NotIn predicate on the "model" field.
func ModelNotIn(vs ...string) predicate.Car {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -214,7 +214,7 @@ func RegisteredAtNEQ(v time.Time) predicate.Car {
// RegisteredAtIn applies the In predicate on the "registered_at" field.
func RegisteredAtIn(vs ...time.Time) predicate.Car {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -225,7 +225,7 @@ func RegisteredAtIn(vs ...time.Time) predicate.Car {
// RegisteredAtNotIn applies the NotIn predicate on the "registered_at" field.
func RegisteredAtNotIn(vs ...time.Time) predicate.Car {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}

View File

@@ -367,10 +367,10 @@ func (cq *CarQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Car, err
if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, car.ForeignKeys...)
}
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*Car).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []interface{}) error {
_spec.Assign = func(columns []string, values []any) error {
node := &Car{config: cq.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
@@ -539,7 +539,7 @@ func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy {
}
// Scan applies the group-by query and scans the result into the given value.
func (cgb *CarGroupBy) Scan(ctx context.Context, v interface{}) error {
func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error {
query, err := cgb.path(ctx)
if err != nil {
return err
@@ -548,7 +548,7 @@ func (cgb *CarGroupBy) Scan(ctx context.Context, v interface{}) error {
return cgb.sqlScan(ctx, v)
}
func (cgb *CarGroupBy) sqlScan(ctx context.Context, v interface{}) error {
func (cgb *CarGroupBy) sqlScan(ctx context.Context, v any) error {
for _, f := range cgb.fields {
if !car.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
@@ -595,7 +595,7 @@ type CarSelect struct {
}
// Scan applies the selector query and scans the result into the given value.
func (cs *CarSelect) Scan(ctx context.Context, v interface{}) error {
func (cs *CarSelect) Scan(ctx context.Context, v any) error {
if err := cs.prepareQuery(ctx); err != nil {
return err
}
@@ -603,7 +603,7 @@ func (cs *CarSelect) Scan(ctx context.Context, v interface{}) error {
return cs.sqlScan(ctx, v)
}
func (cs *CarSelect) sqlScan(ctx context.Context, v interface{}) error {
func (cs *CarSelect) sqlScan(ctx context.Context, v any) error {
rows := &sql.Rows{}
query, args := cs.sql.Query()
if err := cs.driver.Query(ctx, query, args, rows); err != nil {

View File

@@ -21,7 +21,7 @@ type config struct {
// debug enable a debug logging.
debug bool
// log used for logging on debug mode.
log func(...interface{})
log func(...any)
// hooks to execute on mutations.
hooks *hooks
}
@@ -51,7 +51,7 @@ func Debug() Option {
}
// Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option {
func Log(fn func(...any)) Option {
return func(c *config) {
c.log = fn
}

View File

@@ -271,11 +271,11 @@ func IsConstraintError(err error) bool {
type selector struct {
label string
flds *[]string
scan func(context.Context, interface{}) error
scan func(context.Context, any) error
}
// ScanX is like Scan, but panics if an error occurs.
func (s *selector) ScanX(ctx context.Context, v interface{}) {
func (s *selector) ScanX(ctx context.Context, v any) {
if err := s.scan(ctx, v); err != nil {
panic(err)
}

View File

@@ -22,7 +22,7 @@ type (
// testing.T and testing.B and used by enttest.
TestingT interface {
FailNow()
Error(...interface{})
Error(...any)
}
// Option configures client creation.

View File

@@ -45,8 +45,8 @@ func (e GroupEdges) UsersOrErr() ([]*User, error) {
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Group) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
func (*Group) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case group.FieldID:
@@ -62,7 +62,7 @@ func (*Group) scanValues(columns []string) ([]interface{}, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Group fields.
func (gr *Group) assignValues(columns []string, values []interface{}) error {
func (gr *Group) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}

View File

@@ -36,7 +36,7 @@ func IDNEQ(id int) predicate.Group {
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.Group {
return predicate.Group(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -47,7 +47,7 @@ func IDIn(ids ...int) predicate.Group {
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.Group {
return predicate.Group(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -106,7 +106,7 @@ func NameNEQ(v string) predicate.Group {
// NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.Group {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -117,7 +117,7 @@ func NameIn(vs ...string) predicate.Group {
// NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.Group {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}

View File

@@ -360,10 +360,10 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
gq.withUsers != nil,
}
)
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*Group).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []interface{}) error {
_spec.Assign = func(columns []string, values []any) error {
node := &Group{config: gq.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
@@ -414,14 +414,14 @@ func (gq *GroupQuery) loadUsers(ctx context.Context, query *UserQuery, nodes []*
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
assign := spec.Assign
values := spec.ScanValues
spec.ScanValues = func(columns []string) ([]interface{}, error) {
spec.ScanValues = func(columns []string) ([]any, error) {
values, err := values(columns[1:])
if err != nil {
return nil, err
}
return append([]interface{}{new(sql.NullInt64)}, values...), nil
return append([]any{new(sql.NullInt64)}, values...), nil
}
spec.Assign = func(columns []string, values []interface{}) error {
spec.Assign = func(columns []string, values []any) error {
outValue := int(values[0].(*sql.NullInt64).Int64)
inValue := int(values[1].(*sql.NullInt64).Int64)
if nids[inValue] == nil {
@@ -562,7 +562,7 @@ func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy {
}
// Scan applies the group-by query and scans the result into the given value.
func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error {
func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error {
query, err := ggb.path(ctx)
if err != nil {
return err
@@ -571,7 +571,7 @@ func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error {
return ggb.sqlScan(ctx, v)
}
func (ggb *GroupGroupBy) sqlScan(ctx context.Context, v interface{}) error {
func (ggb *GroupGroupBy) sqlScan(ctx context.Context, v any) error {
for _, f := range ggb.fields {
if !group.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
@@ -618,7 +618,7 @@ type GroupSelect struct {
}
// Scan applies the selector query and scans the result into the given value.
func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error {
func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
if err := gs.prepareQuery(ctx); err != nil {
return err
}
@@ -626,7 +626,7 @@ func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error {
return gs.sqlScan(ctx, v)
}
func (gs *GroupSelect) sqlScan(ctx context.Context, v interface{}) error {
func (gs *GroupSelect) sqlScan(ctx context.Context, v any) error {
rows := &sql.Rows{}
query, args := gs.sql.Query()
if err := gs.driver.Query(ctx, query, args, rows); err != nil {

View File

@@ -208,12 +208,12 @@ func (*txDriver) Commit() error { return nil }
func (*txDriver) Rollback() error { return nil }
// Exec calls tx.Exec.
func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error {
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
return tx.tx.Exec(ctx, query, args, v)
}
// Query calls tx.Query.
func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error {
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
return tx.tx.Query(ctx, query, args, v)
}

View File

@@ -58,8 +58,8 @@ func (e UserEdges) GroupsOrErr() ([]*Group, error) {
}
// scanValues returns the types for scanning values from sql.Rows.
func (*User) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
func (*User) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case user.FieldID, user.FieldAge:
@@ -75,7 +75,7 @@ func (*User) scanValues(columns []string) ([]interface{}, error) {
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the User fields.
func (u *User) assignValues(columns []string, values []interface{}) error {
func (u *User) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}

View File

@@ -36,7 +36,7 @@ func IDNEQ(id int) predicate.User {
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.User {
return predicate.User(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -47,7 +47,7 @@ func IDIn(ids ...int) predicate.User {
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.User {
return predicate.User(func(s *sql.Selector) {
v := make([]interface{}, len(ids))
v := make([]any, len(ids))
for i := range v {
v[i] = ids[i]
}
@@ -113,7 +113,7 @@ func AgeNEQ(v int) predicate.User {
// AgeIn applies the In predicate on the "age" field.
func AgeIn(vs ...int) predicate.User {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -124,7 +124,7 @@ func AgeIn(vs ...int) predicate.User {
// AgeNotIn applies the NotIn predicate on the "age" field.
func AgeNotIn(vs ...int) predicate.User {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -177,7 +177,7 @@ func NameNEQ(v string) predicate.User {
// NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}
@@ -188,7 +188,7 @@ func NameIn(vs ...string) predicate.User {
// NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs))
v := make([]any, len(vs))
for i := range v {
v[i] = vs[i]
}

View File

@@ -397,10 +397,10 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
uq.withGroups != nil,
}
)
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*User).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []interface{}) error {
_spec.Assign = func(columns []string, values []any) error {
node := &User{config: uq.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
@@ -489,14 +489,14 @@ func (uq *UserQuery) loadGroups(ctx context.Context, query *GroupQuery, nodes []
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
assign := spec.Assign
values := spec.ScanValues
spec.ScanValues = func(columns []string) ([]interface{}, error) {
spec.ScanValues = func(columns []string) ([]any, error) {
values, err := values(columns[1:])
if err != nil {
return nil, err
}
return append([]interface{}{new(sql.NullInt64)}, values...), nil
return append([]any{new(sql.NullInt64)}, values...), nil
}
spec.Assign = func(columns []string, values []interface{}) error {
spec.Assign = func(columns []string, values []any) error {
outValue := int(values[0].(*sql.NullInt64).Int64)
inValue := int(values[1].(*sql.NullInt64).Int64)
if nids[inValue] == nil {
@@ -637,7 +637,7 @@ func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy {
}
// Scan applies the group-by query and scans the result into the given value.
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error {
func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error {
query, err := ugb.path(ctx)
if err != nil {
return err
@@ -646,7 +646,7 @@ func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error {
return ugb.sqlScan(ctx, v)
}
func (ugb *UserGroupBy) sqlScan(ctx context.Context, v interface{}) error {
func (ugb *UserGroupBy) sqlScan(ctx context.Context, v any) error {
for _, f := range ugb.fields {
if !user.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
@@ -693,7 +693,7 @@ type UserSelect struct {
}
// Scan applies the selector query and scans the result into the given value.
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error {
func (us *UserSelect) Scan(ctx context.Context, v any) error {
if err := us.prepareQuery(ctx); err != nil {
return err
}
@@ -701,7 +701,7 @@ func (us *UserSelect) Scan(ctx context.Context, v interface{}) error {
return us.sqlScan(ctx, v)
}
func (us *UserSelect) sqlScan(ctx context.Context, v interface{}) error {
func (us *UserSelect) sqlScan(ctx context.Context, v any) error {
rows := &sql.Rows{}
query, args := us.sql.Query()
if err := us.driver.Query(ctx, query, args, rows); err != nil {