// Go MySQL Driver - A MySQL-Driver for Go's database/sql package//// Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.//// This Source Code Form is subject to the terms of the Mozilla Public// License, v. 2.0. If a copy of the MPL was not distributed with this file,// You can obtain one at http://mozilla.org/MPL/2.0/.package mysqlimport ()// Scan implements the Scanner interface.// The value type must be time.Time or string / []byte (formatted time-string),// otherwise Scan fails.func ( *NullTime) ( interface{}) ( error) {if == nil { .Time, .Valid = time.Time{}, falsereturn }switch v := .(type) {casetime.Time: .Time, .Valid = , truereturncase []byte: .Time, = parseDateTime(, time.UTC) .Valid = ( == nil)returncasestring: .Time, = parseDateTime([]byte(), time.UTC) .Valid = ( == nil)return } .Valid = falsereturnfmt.Errorf("Can't convert %T to time.Time", )}// Value implements the driver Valuer interface.func ( NullTime) () (driver.Value, error) {if !.Valid {returnnil, nil }return .Time, nil}
The pages are generated with Goldsv0.3.6. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.