mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
all: gofmt -w -r 'interface{} -> any' (#2874)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -64,8 +64,8 @@ func (e FileEdges) ChildrenOrErr() ([]*File, error) {
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*File) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*File) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case file.FieldDeleted:
|
||||
@@ -83,7 +83,7 @@ func (*File) scanValues(columns []string) ([]interface{}, error) {
|
||||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the File fields.
|
||||
func (f *File) assignValues(columns []string, values []interface{}) error {
|
||||
func (f *File) 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)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func IDNEQ(id int) predicate.File {
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int) predicate.File {
|
||||
return predicate.File(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.File {
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int) predicate.File {
|
||||
return predicate.File(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func NameNEQ(v string) predicate.File {
|
||||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.File {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
@@ -131,7 +131,7 @@ func NameIn(vs ...string) predicate.File {
|
||||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.File {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
@@ -233,7 +233,7 @@ func ParentIDNEQ(v int) predicate.File {
|
||||
|
||||
// ParentIDIn applies the In predicate on the "parent_id" field.
|
||||
func ParentIDIn(vs ...int) predicate.File {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
@@ -244,7 +244,7 @@ func ParentIDIn(vs ...int) predicate.File {
|
||||
|
||||
// ParentIDNotIn applies the NotIn predicate on the "parent_id" field.
|
||||
func ParentIDNotIn(vs ...int) predicate.File {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
||||
@@ -395,10 +395,10 @@ func (fq *FileQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*File, e
|
||||
fq.withChildren != nil,
|
||||
}
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*File).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &File{config: fq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
@@ -598,7 +598,7 @@ func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy {
|
||||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := fgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -607,7 +607,7 @@ func (fgb *FileGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
return fgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (fgb *FileGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (fgb *FileGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range fgb.fields {
|
||||
if !file.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
@@ -654,7 +654,7 @@ type FileSelect struct {
|
||||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (fs *FileSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := fs.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -662,7 +662,7 @@ func (fs *FileSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
return fs.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (fs *FileSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (fs *FileSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := fs.sql.Query()
|
||||
if err := fs.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user