我在GORM中聲明以下模型:type DBModel struct { ID uint `gorm:"primaryKey"` CreatedAt *time.Time `json:"_"` UpdatedAt *time.Time `json:"_"` DeletedAt *time.Time `json:"_"` ClientID uint `gorm:"not_null"`}type Address struct { address string city string state string pincode int country string}type Office struct { DBModel DBModel `gorm:"embedded"` Address Address `gorm:"embedded"` Name string}跑步時(shí)func Init(db *gorm.DB) { DB = db DB.AutoMigrate(&models.Office{})}正在遷移的 Office 表包含以下字段:idcreated_atupdated_atdeleted_atclient_idname為什么地址結(jié)構(gòu)未嵌入?
GORM 嵌入式結(jié)構(gòu)未遷移到 SQL
繁華開(kāi)滿天機(jī)
2022-09-26 19:57:10