Skip to content

Commit b5b0ea5

Browse files
authored
Add deprecated message to NullTime (#1144)
* Add deprecated message to NullTime * remove NullTime from README
1 parent f26d659 commit b5b0ea5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,6 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v
459459

460460
**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).
461461

462-
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`.
463-
464462

465463
### Unicode support
466464
Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default.

nulltime_go113.go

+4
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ import (
2828
// }
2929
//
3030
// This NullTime implementation is not driver-specific
31+
//
32+
// Deprecated: NullTime doesn't honor the loc DSN parameter.
33+
// NullTime.Scan interprets a time as UTC, not the loc DSN parameter.
34+
// Use sql.NullTime instead.
3135
type NullTime sql.NullTime

0 commit comments

Comments
 (0)