sqlboiler
sqlboiler copied to clipboard
Generate IN/NIN whereHelpers for nullable types
Enables IN/NIN whereHelper function generation for nullable types addressing issue #851. Based on #910.
The generated helpers take the underlying primitive types, so that a null.String
column would generate a function with signature IN(slice []string) qm.QueryMod
I implemented it this way (instead of accepting nullable values) for a few reasons:
- The code is much simpler
- I imagine most people aren't using
null.*
to construct these clauses currently - A
NULL
in anIN
clause is meaningless in SQL anyway, as it does not affect the result
@stephenafamo do you need anything from me in order to merge this PR? As far as I can tell there are no existing tests for this part of the code generation, but I did generate the test schema and made sure that everything worked as expected. It doesn't seem worth testing the text helpers since the test for a function that simple would look exactly like the original function anyway, but I'm happy to add some if you want.
I haven't had time to manually check it. There was also some discussion about using a potential null/v9
package which would be a breaking change in it self because of the conversation about null/value/set.
Basically, a mix between testing it and making sure there are no breaking changes.
+1 for this, would be really great to have
I haven't had time to manually check it. There was also some discussion about using a potential null/v9 package which would be a breaking change in it self because of the conversation about null/value/set. Basically, a mix between testing it and making sure there are no breaking changes.
@stephenafamo is there a way we can help you test it if you're short on time?
Really anyone just using the branch and confirming that it works and doesn't introduce any breaking changes.
I have included this into my fork and it works fine for my use case.
@fdegiuli kindly fix the merge conflicts so I can merge this
Done. I also updated a function name in light of the changes in the master branch. Thanks for the ping
On Sat, Aug 13, 2022, 5:47 PM Stephen Afam-Osemene @.***> wrote:
@fdegiuli https://github.com/fdegiuli kindly fix the merge conflicts so I can merge this
— Reply to this email directly, view it on GitHub https://github.com/volatiletech/sqlboiler/pull/1083#issuecomment-1214257976, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHCYILNPH2T3ABBBLG3E4LVZA62TANCNFSM5OE732SA . You are receiving this because you were mentioned.Message ID: @.***>
@stephenafamo any hope if this can be pushed in a v4 release, kind of a blocker in a project ?
I'll tag a release within the next week.