【发布时间】:2021-07-30 18:40:55
【问题描述】:
gorm https://gorm.io/docs/models.html 的文档在下面提供了一个示例。
字段Name 和Email 用string 和*string 描述。
这里的主要区别是什么?
另外如何为存储图像链接列表的图像字段提供数据类型?
应该是[]string 还是[]*string?
type User struct {
ID uint
Name string
Email *string
Images []string
Age uint8
Birthday *time.Time
MemberNumber sql.NullString
ActivatedAt sql.NullTime
CreatedAt time.Time
UpdatedAt time.Time
}
【问题讨论】: