Port 251e6b7730 from pgx v3
commit 251e6b7730
Author: Nicholas Wilson <nicholas.wilson@realvnc.com>
Date: Wed Jul 24 12:32:43 2019 +0100
Tidying: make underlyingTimeType consistent with other underlyingFooType
The first return value is ignored when returning false - so there's no
point returning an empty time.Time when it can be nil.
This commit is contained in:
+2
-2
@@ -149,7 +149,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) {
|
||||
switch refVal.Kind() {
|
||||
case reflect.Ptr:
|
||||
if refVal.IsNil() {
|
||||
return time.Time{}, false
|
||||
return nil, false
|
||||
}
|
||||
convVal := refVal.Elem().Interface()
|
||||
return convVal, true
|
||||
@@ -160,7 +160,7 @@ func underlyingTimeType(val interface{}) (interface{}, bool) {
|
||||
return refVal.Convert(timeType).Interface(), true
|
||||
}
|
||||
|
||||
return time.Time{}, false
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// underlyingUUIDType gets the underlying type that can be converted to [16]byte
|
||||
|
||||
Reference in New Issue
Block a user