From b5b0ea55e9c131dcc4a3d5ccb70f06be52f72c9e Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Sun, 16 Aug 2020 11:32:30 +0900 Subject: [PATCH] Add deprecated message to NullTime (#1144) * Add deprecated message to NullTime * remove NullTime from README --- README.md | 2 -- nulltime_go113.go | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 505d2a7e1..834cf10f5 100644 --- a/README.md +++ b/README.md @@ -459,8 +459,6 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v **Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes). -Alternatively you can use the [`NullTime`](https://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`. - ### Unicode support Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default. diff --git a/nulltime_go113.go b/nulltime_go113.go index c392594dd..cb9bcae4a 100644 --- a/nulltime_go113.go +++ b/nulltime_go113.go @@ -28,4 +28,8 @@ import ( // } // // This NullTime implementation is not driver-specific +// +// Deprecated: NullTime doesn't honor the loc DSN parameter. +// NullTime.Scan interprets a time as UTC, not the loc DSN parameter. +// Use sql.NullTime instead. type NullTime sql.NullTime