-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
[bug] Has many does not support nullable IDs #867
Comments
Hello, I encountered the same issue and went a step further to identify the root cause. However, this may not necessarily be a problem; it could be a matter of preference. For instance, when establishing a BelongsTo relations, you can set the value as null, but doing the same for a HasMany relations results in an error. This behavior might be intentional. Therefore, I wanted to ask you whether this is considered an error or a matter of preference. I have provided screenshots of the relevant field below. Thank you. As seen above, if the value is a pointer(which can be null), it throws an error. However, as seen here, if the data is not a pointer(cannot be null), you do not receive an error, just like in the documentation. Lines 105 to 130 in 838a3bc
The location where the error is being If this is indeed a bug, I would be glad to assist you in troubleshooting and resolving the issue. |
Thank you @omerfruk ! The main source of confusion was that |
If the ID type on a
has-many
field is not anint64
, looking up the slice of related objects does not work.Replicated with both
*int64
andnull.Int
.Code snippet (modified from
example/rel-has-many/main.go
Output (truncated)
Stacktrace
The text was updated successfully, but these errors were encountered: