From 9010c554edc5b0d65eb6cb48d735a06edc65d4c4 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 17 Aug 2019 13:33:34 -0500 Subject: [PATCH] Port 251e6b7730c7b31b600e6fe06162e541f3032604 from pgx v3 commit 251e6b7730c7b31b600e6fe06162e541f3032604 Author: Nicholas Wilson 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. --- convert.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/convert.go b/convert.go index 2fd840fc..cc5c10ab 100644 --- a/convert.go +++ b/convert.go @@ -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