I've been strugguling with SQL NULL values in Golang recently. After trying to unsuccessfully unmarshal JSON objects using Decode()
and sql.NullString
, I came to this answer on StackOverflow :
Assigning null to JSON fields instead of empty strings in Golang
The solution using a string pointer seems to work perfectly with Decode() and nil values. So what is the difference between sql.NullString
and *string
?
Is it just about nil checking ?