Has One
和Has Many
有什么区别 Belong To
我有 3 个模型
User
Profile
哪里profile
和user
应该有one to one
关系
Category
category
应该foreign key
去哪里user
type User struct {
gorm.Model
Email *string
Name string
...
}
type Profile struct {
gorm.Model
Phone string
Address string
...
}
type Category struct {
gorm.Model
Name string
}
DIEA
相关分类