From ff4ee8816226b6c84690a56fb3b16c9210e68431 Mon Sep 17 00:00:00 2001 From: Daniel Theophanes Date: Wed, 25 Oct 2017 11:01:46 -0700 Subject: [PATCH] database/sql: scan into *time.Time without reflection Previously scanning time.Time into a *time.Time required reflection. Now it does not. Scanning already checked if the source value was of type time.Time. The only addition was checking the destination was of type *time.Time. Existing tests already scan time.Time into *time.Time, so no new tests were added. Linked issue has performance justification. Fixes #22300 Change-Id: I4eea461c78fad71ce76e7677c8503a1919666931 Reviewed-on: https://go-review.googlesource.com/73232 Run-TryBot: Daniel Theophanes Reviewed-by: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/database/sql/convert.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/database/sql/convert.go b/src/database/sql/convert.go index b44bed559d..b79ec3f7b2 100644 --- a/src/database/sql/convert.go +++ b/src/database/sql/convert.go @@ -259,6 +259,9 @@ func convertAssign(dest, src interface{}) error { } case time.Time: switch d := dest.(type) { + case *time.Time: + *d = s + return nil case *string: *d = s.Format(time.RFC3339Nano) return nil -- 2.48.1