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:
@@ -83,8 +83,8 @@ type Tx struct {
|
||||
|
||||
// ExecQuerier wraps the standard Exec and Query methods.
|
||||
type ExecQuerier interface {
|
||||
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
||||
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
||||
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
|
||||
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
|
||||
}
|
||||
|
||||
// Conn implements dialect.ExecQuerier given ExecQuerier.
|
||||
@@ -93,10 +93,10 @@ type Conn struct {
|
||||
}
|
||||
|
||||
// Exec implements the dialect.Exec method.
|
||||
func (c Conn) Exec(ctx context.Context, query string, args, v interface{}) error {
|
||||
argv, ok := args.([]interface{})
|
||||
func (c Conn) Exec(ctx context.Context, query string, args, v any) error {
|
||||
argv, ok := args.([]any)
|
||||
if !ok {
|
||||
return fmt.Errorf("dialect/sql: invalid type %T. expect []interface{} for args", v)
|
||||
return fmt.Errorf("dialect/sql: invalid type %T. expect []any for args", v)
|
||||
}
|
||||
switch v := v.(type) {
|
||||
case nil:
|
||||
@@ -116,14 +116,14 @@ func (c Conn) Exec(ctx context.Context, query string, args, v interface{}) error
|
||||
}
|
||||
|
||||
// Query implements the dialect.Query method.
|
||||
func (c Conn) Query(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (c Conn) Query(ctx context.Context, query string, args, v any) error {
|
||||
vr, ok := v.(*Rows)
|
||||
if !ok {
|
||||
return fmt.Errorf("dialect/sql: invalid type %T. expect *sql.Rows", v)
|
||||
}
|
||||
argv, ok := args.([]interface{})
|
||||
argv, ok := args.([]any)
|
||||
if !ok {
|
||||
return fmt.Errorf("dialect/sql: invalid type %T. expect []interface{} for args", args)
|
||||
return fmt.Errorf("dialect/sql: invalid type %T. expect []any for args", args)
|
||||
}
|
||||
rows, err := c.QueryContext(ctx, query, argv...)
|
||||
if err != nil {
|
||||
@@ -163,7 +163,7 @@ type NullScanner struct {
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (n *NullScanner) Scan(value interface{}) error {
|
||||
func (n *NullScanner) Scan(value any) error {
|
||||
n.Valid = value != nil
|
||||
if n.Valid {
|
||||
return n.S.Scan(value)
|
||||
@@ -180,5 +180,5 @@ type ColumnScanner interface {
|
||||
Err() error
|
||||
Next() bool
|
||||
NextResultSet() bool
|
||||
Scan(dest ...interface{}) error
|
||||
Scan(dest ...any) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user