Skip to content

Commit b36cd86

Browse files
authored
Drop support of Go 1.12 (#1211)
* Drop support of Go 1.12 * bump Go version in go.mod * remove nulltime_legacy
1 parent bcc459a commit b36cd86

File tree

8 files changed

+31
-91
lines changed

8 files changed

+31
-91
lines changed

.github/workflows/test.yml

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ jobs:
2727
'1.15',
2828
'1.14',
2929
'1.13',
30-
'1.12',
31-
'1.11',
3230
]
3331
mysql = [
3432
'8.0',

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
4040
* Optional placeholder interpolation
4141

4242
## Requirements
43-
* Go 1.10 or higher. We aim to support the 3 latest versions of Go.
43+
* Go 1.13 or higher. We aim to support the 3 latest versions of Go.
4444
* MySQL (4.1+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)
4545

4646
---------------------------------------

driver_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -2771,13 +2771,13 @@ func TestRowsColumnTypes(t *testing.T) {
27712771
nfNULL := sql.NullFloat64{Float64: 0.0, Valid: false}
27722772
nf0 := sql.NullFloat64{Float64: 0.0, Valid: true}
27732773
nf1337 := sql.NullFloat64{Float64: 13.37, Valid: true}
2774-
nt0 := nullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC), Valid: true}
2775-
nt1 := nullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 100000000, time.UTC), Valid: true}
2776-
nt2 := nullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 110000000, time.UTC), Valid: true}
2777-
nt6 := nullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 111111000, time.UTC), Valid: true}
2778-
nd1 := nullTime{Time: time.Date(2006, 01, 02, 0, 0, 0, 0, time.UTC), Valid: true}
2779-
nd2 := nullTime{Time: time.Date(2006, 03, 04, 0, 0, 0, 0, time.UTC), Valid: true}
2780-
ndNULL := nullTime{Time: time.Time{}, Valid: false}
2774+
nt0 := sql.NullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC), Valid: true}
2775+
nt1 := sql.NullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 100000000, time.UTC), Valid: true}
2776+
nt2 := sql.NullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 110000000, time.UTC), Valid: true}
2777+
nt6 := sql.NullTime{Time: time.Date(2006, 01, 02, 15, 04, 05, 111111000, time.UTC), Valid: true}
2778+
nd1 := sql.NullTime{Time: time.Date(2006, 01, 02, 0, 0, 0, 0, time.UTC), Valid: true}
2779+
nd2 := sql.NullTime{Time: time.Date(2006, 03, 04, 0, 0, 0, 0, time.UTC), Valid: true}
2780+
ndNULL := sql.NullTime{Time: time.Time{}, Valid: false}
27812781
rbNULL := sql.RawBytes(nil)
27822782
rb0 := sql.RawBytes("0")
27832783
rb42 := sql.RawBytes("42")

fields.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var (
106106
scanTypeInt64 = reflect.TypeOf(int64(0))
107107
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
108108
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
109-
scanTypeNullTime = reflect.TypeOf(nullTime{})
109+
scanTypeNullTime = reflect.TypeOf(sql.NullTime{})
110110
scanTypeUint8 = reflect.TypeOf(uint8(0))
111111
scanTypeUint16 = reflect.TypeOf(uint16(0))
112112
scanTypeUint32 = reflect.TypeOf(uint32(0))

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/go-sql-driver/mysql
22

3-
go 1.10
3+
go 1.13

nulltime.go

+21
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,32 @@
99
package mysql
1010

1111
import (
12+
"database/sql"
1213
"database/sql/driver"
1314
"fmt"
1415
"time"
1516
)
1617

18+
// NullTime represents a time.Time that may be NULL.
19+
// NullTime implements the Scanner interface so
20+
// it can be used as a scan destination:
21+
//
22+
// var nt NullTime
23+
// err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
24+
// ...
25+
// if nt.Valid {
26+
// // use nt.Time
27+
// } else {
28+
// // NULL value
29+
// }
30+
//
31+
// This NullTime implementation is not driver-specific
32+
//
33+
// Deprecated: NullTime doesn't honor the loc DSN parameter.
34+
// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
35+
// Use sql.NullTime instead.
36+
type NullTime sql.NullTime
37+
1738
// Scan implements the Scanner interface.
1839
// The value type must be time.Time or string / []byte (formatted time-string),
1940
// otherwise Scan fails.

nulltime_go113.go

-40
This file was deleted.

nulltime_legacy.go

-39
This file was deleted.

0 commit comments

Comments
 (0)