This is an automated email from the ASF dual-hosted git repository. francischuang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite-avatica-go.git
commit 3b527fe8ddb95455be0a958c0d441185c684c7f6 Author: Francis Chuang <[email protected]> AuthorDate: Mon Oct 10 08:58:19 2022 +1100 [CALCITE-5317] Remove redundant type declarations --- connection.go | 2 +- driver_go18_hsqldb_test.go | 3 ++- driver_go18_phoenix_test.go | 3 ++- driver_hsqldb_test.go | 2 +- driver_phoenix_test.go | 2 +- result.go | 2 +- statement.go | 4 ++-- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/connection.go b/connection.go index 28bb374..8fc6cdb 100644 --- a/connection.go +++ b/connection.go @@ -233,7 +233,7 @@ func (c *conn) avaticaErrorToResponseErrorOrError(err error) error { // ResetSession implements driver.SessionResetter. // (From Go 1.10) -func (c *conn) ResetSession(ctx context.Context) error { +func (c *conn) ResetSession(_ context.Context) error { if c.connectionId == "" { return driver.ErrBadConn } diff --git a/driver_go18_hsqldb_test.go b/driver_go18_hsqldb_test.go index 21c59be..04d5f89 100644 --- a/driver_go18_hsqldb_test.go +++ b/driver_go18_hsqldb_test.go @@ -1,3 +1,4 @@ +//go:build go1.8 // +build go1.8 /* @@ -387,7 +388,7 @@ func TestHSQLDBColumnTypes(t *testing.T) { nullable: true, ok: true, }, - scanType: reflect.TypeOf(bool(false)), + scanType: reflect.TypeOf(false), }, { databaseTypeName: "TIME", diff --git a/driver_go18_phoenix_test.go b/driver_go18_phoenix_test.go index bb7b322..757993e 100644 --- a/driver_go18_phoenix_test.go +++ b/driver_go18_phoenix_test.go @@ -1,3 +1,4 @@ +//go:build go1.8 // +build go1.8 /* @@ -523,7 +524,7 @@ func TestPhoenixColumnTypes(t *testing.T) { nullable: true, ok: true, }, - scanType: reflect.TypeOf(bool(false)), + scanType: reflect.TypeOf(false), }, { databaseTypeName: "TIME", diff --git a/driver_hsqldb_test.go b/driver_hsqldb_test.go index 334f24a..d5f47f1 100644 --- a/driver_hsqldb_test.go +++ b/driver_hsqldb_test.go @@ -187,7 +187,7 @@ func TestHSQLDBDataTypes(t *testing.T) { tmstmpValue time.Time = time.Date(2100, 2, 1, 21, 21, 21, 222000000, time.UTC) ) - copy(binValue[:], []byte("test")) + copy(binValue[:], "test") // dbt.mustExec(`INSERT INTO `+dbt.tableName+` (int, tint, sint, bint, num, dec, re, flt, dbl, bool, ch, var, bin, varbin, dt, tm, tmstmp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, dbt.mustExec(`INSERT INTO `+dbt.tableName+` (int, tint, sint, bint, num, dec, re, flt, dbl, bool, ch, var, bin, varbin, dt, tmstmp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, diff --git a/driver_phoenix_test.go b/driver_phoenix_test.go index 0ec2bd6..d117785 100644 --- a/driver_phoenix_test.go +++ b/driver_phoenix_test.go @@ -183,7 +183,7 @@ func TestPhoenixDataTypes(t *testing.T) { varbinValue []byte = []byte("testtesttest") ) - copy(binValue[:], []byte("test")) + copy(binValue[:], "test") dbt.mustExec(`UPSERT INTO `+dbt.tableName+` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, integerValue, diff --git a/result.go b/result.go index 218822c..bf88d47 100644 --- a/result.go +++ b/result.go @@ -28,7 +28,7 @@ type result struct { // after, for example, an INSERT into a table with primary // key. func (r *result) LastInsertId() (int64, error) { - return 0, errors.New("use 'SELECT CURRENT VALUE FOR your.sequence' to get the last inserted id. For more information, see: https://phoenix.apache.org/sequences.html.") + return 0, errors.New("use 'SELECT CURRENT VALUE FOR your.sequence' to get the last inserted id. For more information, see: https://phoenix.apache.org/sequences.html") } // RowsAffected returns the number of rows affected by the diff --git a/statement.go b/statement.go index b6b7549..36e9ad6 100644 --- a/statement.go +++ b/statement.go @@ -222,7 +222,7 @@ func (s *stmt) parametersToTypedValues(vals []namedValue) []*message.TypedValue // Calculate milliseconds since 00:00:00.000 base := time.Date(v.Year(), v.Month(), v.Day(), 0, 0, 0, 0, time.FixedZone(zone, offset)) - typed.NumberValue = int64(v.Sub(base).Nanoseconds() / int64(time.Millisecond)) + typed.NumberValue = v.Sub(base).Nanoseconds() / int64(time.Millisecond) case "DATE", "UNSIGNED_DATE": typed.Type = message.Rep_JAVA_SQL_DATE @@ -244,7 +244,7 @@ func (s *stmt) parametersToTypedValues(vals []namedValue) []*message.TypedValue // Calculate number of milliseconds since 1970-01-01 00:00:00.000 base := time.Date(1970, 1, 1, 0, 0, 0, 0, time.FixedZone(zone, offset)) - typed.NumberValue = int64(v.Sub(base).Nanoseconds() / int64(time.Millisecond)) + typed.NumberValue = v.Sub(base).Nanoseconds() / int64(time.Millisecond) } } }
