aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/convert.go
diff options
context:
space:
mode:
authorDaniel Theophanes <kardianos@gmail.com>2017-10-25 11:01:46 -0700
committerDaniel Theophanes <kardianos@gmail.com>2017-10-25 19:29:16 +0000
commitff4ee8816226b6c84690a56fb3b16c9210e68431 (patch)
tree3572428566c40a268d0f736a43617cd59ea30e99 /src/database/sql/convert.go
parent187957d37056592203fd758ae0245a28f4518122 (diff)
downloadgo-ff4ee8816226b6c84690a56fb3b16c9210e68431.tar.xz
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 <kardianos@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/database/sql/convert.go')
-rw-r--r--src/database/sql/convert.go3
1 files changed, 3 insertions, 0 deletions
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