File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -47,23 +47,25 @@ type NullTime struct {
4747func (nt * NullTime ) Scan (value interface {}) (err error ) {
4848 if value == nil {
4949 nt .Time , nt .Valid = time.Time {}, false
50- } else {
51- switch v := value .(type ) {
52- case time.Time :
53- nt .Time , nt .Valid = v , true
54- case []byte :
55- nt .Time , err = parseDateTime (string (v ), time .UTC )
56- nt .Valid = (err == nil )
57- case string :
58- nt .Time , err = parseDateTime (v , time .UTC )
59- nt .Valid = (err == nil )
60- default :
61- nt .Valid = false
62- err = fmt .Errorf ("Can't convert %T to time.Time" , v )
63- }
50+ return
6451 }
6552
66- return
53+ switch v := value .(type ) {
54+ case time.Time :
55+ nt .Time , nt .Valid = v , true
56+ return
57+ case []byte :
58+ nt .Time , err = parseDateTime (string (v ), time .UTC )
59+ nt .Valid = (err == nil )
60+ return
61+ case string :
62+ nt .Time , err = parseDateTime (v , time .UTC )
63+ nt .Valid = (err == nil )
64+ return
65+ }
66+
67+ nt .Valid = false
68+ return fmt .Errorf ("Can't convert %T to time.Time" , value )
6769}
6870
6971// Value implements the driver Valuer interface.
You can’t perform that action at this time.
0 commit comments