From: Daniel Theophanes Date: Wed, 25 Oct 2017 18:01:46 +0000 (-0700) Subject: database/sql: scan into *time.Time without reflection X-Git-Tag: go1.10beta1~593 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ff4ee8816226b6c84690a56fb3b16c9210e68431;p=gostls13.git 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 --- 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