-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scan() does not populate has-many relationships #606
Comments
I am also experiencing this. I think I found what is happening: The value of model used here to find joins: https://github.com/uptrace/bun/blob/master/query_select.go#L877 Will not have any, because its derived from https://github.com/uptrace/bun/blob/master/query_select.go#L849 and https://github.com/uptrace/bun/blob/master/query_base.go#L188 |
This works for me, bun 1.1.8
Although without a data loader it is inefficient as it executes a separate query for every Match for every User. |
any update on that issue? |
Same here, this behaviour took me about two days to figure out - imposter syndrome included. |
I've been bitten by this as well, ended up doing crappy workarounds until I figured out what was wrong. |
Hi all! I faced a similar issue but found a solution by passing only the
|
In context of the 'has-many' example, if you do:
users[k].Profiles
will always benil
, regardless of the related Profiles they might have.I don't think this is by design, as the documentation states that you can pass a struct as a 'destination', and no mention about the above behaviour.
The text was updated successfully, but these errors were encountered: