File tree 1 file changed +17
-15
lines changed
1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -47,23 +47,25 @@ type NullTime struct {
47
47
func (nt * NullTime ) Scan (value interface {}) (err error ) {
48
48
if value == nil {
49
49
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
64
51
}
65
52
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 )
67
69
}
68
70
69
71
// Value implements the driver Valuer interface.
You can’t perform that action at this time.
0 commit comments