Skip to content
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

Query.or_field #110

Closed
Jaymon opened this issue Jun 11, 2020 · 0 comments
Closed

Query.or_field #110

Jaymon opened this issue Jun 11, 2020 · 0 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Jun 11, 2020

Ran into this the other day, I needed to check <FIELD_NAME> IS NULL OR <FIELD_NAME> >= ?.

A good syntax for this would be:

Foo.query.or_bar("<VALUE_1>", "<VALUE_2>")

Which would result in:

(bar = '<VALUE_1>' OR bar = '<VALUE_2>')

But that can also just be done with in, and I need support for other operators, I've thought about something like:

Foo.query.or_bar(
    Foo.query.is_bar("<VALUE_1>"),
    Foo.query.gte_bar("<VALUE_2>")
)

Which works but is verbose. The queries passed into the or_bar method would only have their where_fields used.

@Jaymon Jaymon closed this as completed in f22b7ee Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant