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

Use default operator in binop_query #10

Open
lverweijen opened this issue Nov 23, 2022 · 0 comments
Open

Use default operator in binop_query #10

lverweijen opened this issue Nov 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@lverweijen
Copy link
Owner

lverweijen commented Nov 23, 2022

Building on #9 it might be convenient to have a default operator in simple queries. The default operation can always be overwritten when required.

So that the following queries give the same result:

and_query(a=3)  # Proposed
and_query(a.eq = 3)
and_query('a eq 3')

For scalars the most logical default operator is eq.
For vectors, it should probably use in instead of eq.
This seems to rhyme well with the R convention that a scalar is just a vector of length 1.

So that:

and_query(FirstName = c("John", "James"))  # Proposed
and_query(FirstName.in = c("John", "James"))
and_query("FirstName in ('John', 'James')")

Al give the same result.

Empty vectors should probably use in as well (although the sample ODataService at odata.org doesn't seem to support this):

and_query(FirstName = vector())  # Proposed
and_query("FirstName in ()")

However null should use eq (even though c() is equivalent to NULL in R):

and_query(FirstName = c())  # Proposed
and_query(FirstName = NULL)  # Proposed
and_query("FirstName eq null")
@lverweijen lverweijen added the enhancement New feature or request label Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant