我正在使用
我还注意到,对于许多Golang ORM,它们使用
gorm
来定义我的数据库表结构。注意到gorm
本身将time.Time
用于created_at
,而将*time.Time
用于deleted_at
。我认为这是因为deleted_at
有时可能为NULL
。我还注意到,对于许多Golang ORM,它们使用
sql.NullFloat64
来存储可能是float64
或NULL
的数据库值。为什么不直接使用*float64
而是要用sql.NullFloat64
?两者有什么区别?type Geo struct {
latitude *float64
longitude sql.NullFloat64
}
// What is the difference between latitude and longitude in this case?