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

@@ -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
}
@@ -49,7 +49,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

@@ -267,11 +267,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

@@ -30,17 +30,17 @@ var (
)
// Allowf returns an formatted wrapped Allow decision.
func Allowf(format string, a ...interface{}) error {
func Allowf(format string, a ...any) error {
return fmt.Errorf(format+": %w", append(a, Allow)...)
}
// Denyf returns an formatted wrapped Deny decision.
func Denyf(format string, a ...interface{}) error {
func Denyf(format string, a ...any) error {
return fmt.Errorf(format+": %w", append(a, Deny)...)
}
// Skipf returns an formatted wrapped Skip decision.
func Skipf(format string, a ...interface{}) error {
func Skipf(format string, a ...any) error {
return fmt.Errorf(format+": %w", append(a, Skip)...)
}

View File

@@ -202,12 +202,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

@@ -24,8 +24,8 @@ type User struct {
}
// 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:
@@ -41,7 +41,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

@@ -35,7 +35,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]
}
@@ -46,7 +46,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]
}
@@ -105,7 +105,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]
}
@@ -116,7 +116,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

@@ -327,10 +327,10 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
nodes = []*User{}
_spec = uq.querySpec()
)
_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)
return node.assignValues(columns, values)
@@ -462,7 +462,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
@@ -471,7 +471,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)}
@@ -518,7 +518,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
}
@@ -526,7 +526,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 {