DB:
column: name
value: NULL
Get the record from DB with gorm, then
var name string
if name != nil {
//
}
Got error:
invalid operation: name != nil (mismatched types string and nil)
Yes, nil is using for int type in go, but this case, the value in DB is NULL
but not ""
, so it's necessary to check null
, how to do?