如果我正在尋找有信用卡號碼的人,CreditCardNumber這是正確的方法嗎?type Person struct { gorm.Model Name string CreditCard CreditCard }type CreditCard struct { gorm.Model PersonID *uint Number string}database.dbClient. Preload("CreditCard"). Where("credit_card.number = ?", CreditCardNumber). Joins("left join credit_cards on person.id = credit_card.person_id AND credit_card.deleted_at is NULL"). First(&Person)
- 1 回答
- 0 關(guān)注
- 132 瀏覽
添加回答
舉報
0/150
提交
取消