You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User and UserProp models are saved independently in different API endpoints so they are not connected by a foreign key. But in another API endpoint they should load together so used Preload("UserProps") with multiple foreign keys to achieve this.
GORM Playground Link
go-gorm/playground#537
Description
User
andUserProp
models are saved independently in different API endpoints so they are not connected by a foreign key. But in another API endpoint they should load together so usedPreload("UserProps")
with multiple foreign keys to achieve this.Expected
UserProp
andUser
connects byCompanyID
andManagerID
. Since those fields are nullable inUser
model it leads toUser.UserProps
emptiness.So, the following SQL is expected to be generated (will return 0 rows, and that's the idea: no panics):
Actual
We got panic in case of one of values is NULL:
The text was updated successfully, but these errors were encountered: