With sql.Rows.Scan, when you are trying to read a NULL from the query results into a Go type, you will get an error (unless the type has nil). This PR changes that behaviour for SQLair. Instead of an error, the value will be set to a zero on finding a Null in the database.
If the type is already a pointer or implements sql.Scanner it is passed straight to Rows.Scan. However, if it not, a pointer to it is passed to Scan and after scanning, if the pointer is nil then the value is zeroed, otherwise it is set.
With
sql.Rows.Scan
, when you are trying to read aNULL
from the query results into a Go type, you will get an error (unless the type hasnil
). This PR changes that behaviour for SQLair. Instead of an error, the value will be set to a zero on finding a Null in the database.If the type is already a pointer or implements
sql.Scanner
it is passed straight toRows.Scan
. However, if it not, a pointer to it is passed toScan
and after scanning, if the pointer isnil
then the value is zeroed, otherwise it is set.