-
Notifications
You must be signed in to change notification settings - Fork 545
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
OrWhere wrong in docs #1346
OrWhere wrong in docs #1346
Comments
Apologies, the docs are wrong. Both Both of them can be used to express Using qm.Where("(a = ? OR b = ?) AND (c = ? OR d = ?)", a, b, c, d), Using qm.Expr(
models.PilotWhere.A.EQ(a),
qm.Or2(models.PilotWhere.B.EQ(b)),
),
qm.Expr(
models.PilotWhere.C.EQ(c),
qm.Or2(models.PilotWhere.D.EQ(d)),
), |
Thank you for the quick reply and the answer. One more question about the docs, at the same section, it shows a sequence of conditions like this:
But I guess those conditions have to be wrapped also by What about things like
or
How to wrap them? the comment in the code of qm.Expr seems to state, that only WHERE constraints can be used it it, |
Most of the mods can be used multiple times without any issues. WHERE (a AND b) AND (c OR d) That is why |
This is a question about the docs, so I skip the "issue question", as they are not relevant for my issue.
I am still trying to figure out how to use where in query-building to create complex statments (like (A || B ) & (C || D) or something). I guess there is no type safe query.
But, what I think is wrong in the docs, is this example at https://github.com/volatiletech/sqlboiler#query-mod-system:
The where function expects first a string, but return type of Expr is a QueryMod. I also don't understand the meaning of Or2(models.PilotAge), as Or2 expects a WHERE query, right?
Would be great if you could expand on this example, how its meant to be used.
The text was updated successfully, but these errors were encountered: