-
Notifications
You must be signed in to change notification settings - Fork 161
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
Incompatibility with Gorm #59
Comments
What is the error? Please copy and paste to here. |
Thanks for the quick reply, @giautm! Here's the error I'm seeing:
|
I don't see relation between One and Two model. Do you add relation by hand? plz provide more detail about database schema.
|
Gorm infers the relation – you'll see that I just heard back from the creator of Gorm and it seems that So if my Does that make sense? Would that be fixable here? |
Well, a zero-value ULID is a valid ULID, in the same way that 0 is a valid int. How would you solve this problem for ints? edit: Possible paths forward, as I see them:
Any others? |
I agree about your first option and also think your second option sounds like the best way forward. I managed to solve it in another manner (see below) but yours is more generally applicable, so that's probably what most users should use. You have already done a lot of good work here but can I still just suggest adding a line or two about this to the README? I would have found that immensely useful. :) Either way, thank you so much for the quick help! (In case anyone else comes looking months from now, my own solution was centralizing Gorm interactions through a set of functions where I can do null/empty-checks and use Gorm's |
I'm having some trouble with getting this library playing together with Gorm and I'm not entirely sure where the fault is at. Maybe someone here could help point me in a direction to figure out where (and how) to solve this?
The problem is that Gorm doesn't seem to understand when
ulid.ULID
s are empty, so when I have such a field it tried writing to it, which causes foreign key failure.I've seen that this library implements a SQL Valuer and it looks good but, still, it doesn't work for me.
Any ideas what could be going wrong?
Here's an example:
The text was updated successfully, but these errors were encountered: