I'm using gorm
to define my db table schema. Noticed that gorm
itself uses time.Time
for created_at
and *time.Time
for deleted_at
. I'm assuming this is because deleted_at
has cases of being NULL
.
I also noticed that for many Golang ORMs they use sql.NullFloat64
for storing db values that could be a float64
or NULL
. Why not just use *float64
instead of sql.NullFloat64
? What's the difference?
type Geo struct {
latitude *float64
longitude sql.NullFloat64
}
// What is the difference between latitude and longitude in this case?