Closed
Description
Would it be an idea to extend the Nullable types to include NullTime as well?
Something like
type NullTime struct {
Time time.Time
Valid bool
}
// Scan implements the Scanner interface.
func (nt *NullTime) Scan(value interface{}) error {
if value == nil {
nt.Time, nt.Valid = time.Time{}, false
return nil
}
nt.Valid = true
return convertAssign(&nt.Time, value)
}
// Value implements the Valuer interface.
func (nt NullTime) Valuer() (driver.Value, error) {
if !nt.Valid {
return nil, nil
}
return nt.Time, nil
}
Just copy paste into ...go/src/database/sql/sql.go, should work.