2
0

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:
Jack Christensen
2019-08-17 13:33:34 -05:00
parent bcc139a365
commit 9010c554ed
+2 -2
View File
@@ -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