GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
I have two tables
type PayLog struct {
ID int `json:"id" gorm:"column:id"`
Description string `json:"description" gorm:"column:description"`
OutTradeNo string `json:"out_trade_no" gorm:"column:out_trade_no"`
TimeExpire *time.Time `json:"time_expire" gorm:"column:time_expire"`
Attach string `json:"attach" gorm:"column:attach"`
Total int `json:"total" gorm:"column:total"`
GoodsDetail string `json:"goods_detail" gorm:"column:goods_detail"`
SubMerchantId int `json:"sub_merchant_id" gorm:"column:sub_merchant_id"`
CodeUrl string `json:"code_url" gorm:"column:code_url"`
Created string `json:"created" gorm:"column:created"`
}
type SubMerchant struct {
ID *int `json:"id"`
SpAppid *string `json:"sp_appid"`
SpWechatid *string `json:"sp_wechatid"`
PayerClientIp *string `json:"payer_client_ip"`
DeviceId *string `json:"device_id"`
StoreId *string `json:"store_id"`
Name *string `json:"name"`
AreaCode *string `json:"area_code"`
Address *string `json:"address"`
MerchantId *int `json:"merchant_id"`
}
When I query a single piece of data
var paylog PayLog
global.Orm.Table("PayLogTable").First(&paylog)
The results obtained without any query conditions are normal
When I add any query condition, id or other
var paylog payment.WechatPayLog
// global.Orm.Table("PayLogTable").Where("id = ?", 9).First(&paylog)
global.Orm.Table("PayLogTable").Where("out_trade_no = ?", "xxxxxxxxxxxxxxx").First(&paylog)
The results obtained
Id -> PayLog.Id Description -> PayLog.Id OutTradeNo -> PayLog.OutTradeNo TimeExpire -> ? Attach -> SubMerchant.PayerClientIp Total -> ? GoodsDetail -> ? SubMerchantId -> ? CodeUrl -> SubMerchant.Name Created -> SubMerchant.AreaCode
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨