After using db.Query
and rows.Scan
to populate a sql.NullString
with a NULL
value such that its .Valid
field is false
, is it guaranteed that its .String
will hold the empty string ""
?
I ask because it would be snazzy if I could use this:
res := ns.String
Instead of this:
var res string
if ns.Valid {
res = ns.String
}