第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

GORM 嵌入式結(jié)構(gòu)未遷移到 SQL

GORM 嵌入式結(jié)構(gòu)未遷移到 SQL

Go
繁華開(kāi)滿天機(jī) 2022-09-26 19:57:10
我在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)未嵌入?
查看完整描述

1 回答

?
弒天下

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超8個(gè)贊

好的,明白了。


地址結(jié)構(gòu)的字段應(yīng)為導(dǎo)出字段。字段必須以大寫(xiě)字母開(kāi)頭才能導(dǎo)出。


更改地址結(jié)構(gòu)可以完成以下工作:


type Address struct {

    Address string

    City    string

    State   string

    Pincode int

    Country string

}


查看完整回答
反對(duì) 回復(fù) 2022-09-26
  • 1 回答
  • 0 關(guān)注
  • 83 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)