-
Notifications
You must be signed in to change notification settings - Fork 4
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
Nested comparison groups #3
Comments
|
What if the So for example: WHERE important = ? AND (your_column = ? OR your_column = ? OR something_else LIKE ?) you could do const query = q.select('everything')
.from('table')
.where('important', true)
.where(
q.where('your_column', true)
.orWhere('your_column', randomVariable)
.orWhereLike('something_else', anotherVariable)
) |
ooooooh that's an interesting idea. My kneejerk reaction is that I like it |
we could make |
Need to make it work for for situations like WHERE notimportant = ? OR (your_column = ? AND your_column = ? AND something_else LIKE ?) |
Sure, it'd be const query = q.select('everything')
.from('table')
.where('notimportant', true)
.orWhere(
q.where('your_column', true)
.where('your_column', randomVariable)
.whereLike('something_else', anotherVariable)
) |
So, it wouldn't be difficult to make this work equivalently for the Maybe we just live with that limitation for now? |
If we take this path forward then I think the way to do it would be to pass in another property to the options object (second argument to I would be fine with merging this solution now. Even if we find another better way that works for everything including Right now this code q.select('everything')
.from('table')
.where('notimportant', true)
.orWhere(
q.where('your_column', true)
.where('your_column', 'randomVariable')
.whereLike('something_else', 'anotherVariable')
) produces this query SELECT everything
FROM table
WHERE notimportant = true OR WHERE your_column = true AND your_column = 'randomVariable' AND something_else LIKE 'anotherVariable' and changing it to return something more reasonable doesn't hurt us I think. |
group
should be exposed on the original imported object, but not the query object returned by every individual call.Are
like
andcompare
good function names? Isgroup
a good function name?The text was updated successfully, but these errors were encountered: