Description
this is my work preload struct in grom version 1.21.15
type MapProduct struct {
Model
ProductID uint json:"product_id"
LinkID int64 json:"link_id"
LinkVariantID int64 json:"link_variant_id"
VariantOption string json:"variant_option"
MapShopID uint json:"map_shop_id"
Type ShopType json:"type"
CreatedByUserID uint json:"created_by_user_id"
UpdatedByUserID uint json:"updated_by_user_id,omitempty"
DeletedByUserID uint json:"deleted_by_user_id,omitempty"
ProductTemp ProductTemp json:"product_temp,omitempty" gorm:"foreignKey:MapProductID;references:ID" copier:"-"
Product Product json:"product,omitempty" gorm:"foreignKey:ProductID;references:ID"
}
this is function that i use preload to struct func (repo mapProductRepository) FindAllByLinkIDs(db gorm.DB, linkIds []int64, mapShopID uint) ([]models.MapProduct, error) { entities := []models.MapProduct{} err := db.Where("link_id in (?) and map_shop_id = ?", linkIds, mapShopID).Preload(clause.Associations).Find(&entities).Error if err != nil { return nil, err }
return entities, nil
}
i got result with preload product and other but lasted version when i query didn't get any preload now i'm downgrade to 1.21.15 it work
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 ✨