From 507dc0f3e95c60620e71b66b6c341f60d60f0ecd Mon Sep 17 00:00:00 2001 From: Preslav Rachev Date: Sat, 4 Feb 2023 19:36:11 +0100 Subject: [PATCH] Revert --- SQLInterface.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SQLInterface.md b/SQLInterface.md index 0e92360a..1561f11e 100644 --- a/SQLInterface.md +++ b/SQLInterface.md @@ -136,11 +136,9 @@ Only [`NullByte`](https://pkg.go.dev/database/sql/#NullByte), [`NullBool`](https `database/sql`. Implementations of database-specific null types are left to the database driver. User types supporting `NULL` can be created by implementing interfaces [`database/sql/driver.Valuer`](https://pkg.go.dev/database/sql/driver/#Valuer) and [`database/sql.Scanner`](https://pkg.go.dev/database/sql/#Scanner). -You can also pass pointer types. +You can also pass pointer types. Be careful for performance issues as it requires extra memory allocations. ```go var name *string err := db.QueryRowContext(ctx, "SELECT name FROM names WHERE id = $1", id).Scan(&name) -``` - -NOTE: Scanning will result in extra heap allocation, regardless of whether you use a pointer or one of the `Null`-types. From the point of pure memory allocation, the two alternatives are analogous and differ only in their intended reader semantic. \ No newline at end of file +``` \ No newline at end of file