Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

nulltime_legacy.go 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
  2. //
  3. // Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public
  6. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  7. // You can obtain one at http://mozilla.org/MPL/2.0/.
  8. // +build !go1.13
  9. package mysql
  10. import (
  11. "time"
  12. )
  13. // NullTime represents a time.Time that may be NULL.
  14. // NullTime implements the Scanner interface so
  15. // it can be used as a scan destination:
  16. //
  17. // var nt NullTime
  18. // err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
  19. // ...
  20. // if nt.Valid {
  21. // // use nt.Time
  22. // } else {
  23. // // NULL value
  24. // }
  25. //
  26. // This NullTime implementation is not driver-specific
  27. type NullTime struct {
  28. Time time.Time
  29. Valid bool // Valid is true if Time is not NULL
  30. }
  31. // for internal use.
  32. // the mysql package uses sql.NullTime if it is available.
  33. // if not, the package uses mysql.NullTime.
  34. type nullTime = NullTime // sql.NullTime is not available