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
9// +build !go1.13
10
11package mysql
12
13import (
14	"time"
15)
16
17// NullTime represents a time.Time that may be NULL.
18// NullTime implements the Scanner interface so
19// it can be used as a scan destination:
20//
21//  var nt NullTime
22//  err := db.QueryRow("SELECT time FROM foo WHERE id=?", id).Scan(&nt)
23//  ...
24//  if nt.Valid {
25//     // use nt.Time
26//  } else {
27//     // NULL value
28//  }
29//
30// This NullTime implementation is not driver-specific
31type NullTime struct {
32	Time  time.Time
33	Valid bool // Valid is true if Time is not NULL
34}
35