Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace interface{} with any #1560

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ It's possible to access the last inserted ID and number of affected rows for mul

```go
conn, _ := db.Conn(ctx)
conn.Raw(func(conn interface{}) error {
conn.Raw(func(conn any) error {
ex := conn.(driver.Execer)
res, err := ex.Exec(`
UPDATE point SET x = 1 WHERE y = 2;
Comment on lines 326 to 332
Copy link

@coderabbitai coderabbitai bot Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [3-3]

There's a possible spelling mistake with "MySQL-Driver". Consider specifying it as "MySQL driver" for clarity and consistency with common terminology.

- A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) package
+ A MySQL driver for Go's [database/sql](https://golang.org/pkg/database/sql/) package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai If this is "outside the diff hunks", why are you posting this here? This is just irrelevant.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dolmen, thank you for your feedback. You're correct that the comment was outside the modified lines in the pull request, and I understand your concern about the relevance of such comments to the immediate changes.

The automated review process is designed to ensure overall quality and consistency throughout the file, which sometimes includes suggestions on parts of the file not directly modified but still visible in the broader context of the pull request. However, I appreciate that the primary focus should be on the changes made in the diff hunks.

If you prefer, I can adjust the settings to limit comments to only the lines modified in the pull request. Would you like me to make this change for future reviews?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dolmen See https://github.com/apps/coderabbitai
I just trying it. It is far from perfect, but interesting enough.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Expand Down
116 changes: 58 additions & 58 deletions driver_test.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ var defaultLogger = Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime|lo

// Logger is used to log critical error messages.
type Logger interface {
Print(v ...interface{})
Print(v ...any)
}

// NopLogger is a nop implementation of the Logger interface.
type NopLogger struct{}

// Print implements Logger interface.
func (nl *NopLogger) Print(_ ...interface{}) {}
func (nl *NopLogger) Print(_ ...any) {}

// SetLogger is used to set the default logger for critical errors.
// The initial logger is os.Stderr.
Expand Down
2 changes: 1 addition & 1 deletion fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var (
scanTypeString = reflect.TypeOf("")
scanTypeNullString = reflect.TypeOf(sql.NullString{})
scanTypeBytes = reflect.TypeOf([]byte{})
scanTypeUnknown = reflect.TypeOf(new(interface{}))
scanTypeUnknown = reflect.TypeOf(new(any))
)

type mysqlField struct {
Expand Down
2 changes: 1 addition & 1 deletion nulltime.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type NullTime sql.NullTime
// Scan implements the Scanner interface.
// The value type must be time.Time or string / []byte (formatted time-string),
// otherwise Scan fails.
func (nt *NullTime) Scan(value interface{}) (err error) {
func (nt *NullTime) Scan(value any) (err error) {
if value == nil {
nt.Time, nt.Valid = time.Time{}, false
return
Expand Down
2 changes: 1 addition & 1 deletion nulltime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

func TestScanNullTime(t *testing.T) {
var scanTests = []struct {
in interface{}
in any
error bool
valid bool
time time.Time
Expand Down
2 changes: 1 addition & 1 deletion statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ type converter struct{}
// implementation does not. This function should be kept in sync with
// database/sql/driver defaultConverter.ConvertValue() except for that
// deliberate difference.
func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
func (c converter) ConvertValue(v any) (driver.Value, error) {
if driver.IsValue(v) {
return v, nil
}
Expand Down
4 changes: 2 additions & 2 deletions statement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestConvertPointer(t *testing.T) {
}

func TestConvertSignedIntegers(t *testing.T) {
values := []interface{}{
values := []any{
int8(-42),
int16(-42),
int32(-42),
Expand Down Expand Up @@ -106,7 +106,7 @@ func (u myUint64) Value() (driver.Value, error) {
}

func TestConvertUnsignedIntegers(t *testing.T) {
values := []interface{}{
values := []any{
uint8(42),
uint16(42),
uint32(42),
Expand Down
Loading