Re: code review 5630052: database/sql: treat pointers as nullable types like enc... (issue 5630052)

159 views
Skip to first unread message

iked...@gmail.com

unread,
Jan 15, 2022, 5:19:44 PM1/15/22
to awpri...@gmail.com, golan...@googlegroups.com, brad...@golang.org, r...@golang.org, rogp...@gmail.com, re...@codereview-hr.appspotmail.com
Hi,

I believe this feature works perfect (and really useful! Thanks!).
https://go.dev/play/p/oN8MLbd_T_L

But somehow it doesn't look documented anywhere.

I plan to add following descriptions to
https://github.com/golang/go/wiki/SQLInterface ("Dealing with NULL"
section):

----
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)
```
----

That's a Wiki and provides no reviewing system, and I want this reviewed
before publish.
Let me know if this feature should not be documented for some reason.


https://codereview.appspot.com/5630052/
Reply all
Reply to author
Forward
0 new messages