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

datastore: refactor Query.Filter() to use separate parameters for field name and operation #5977

Closed
telpirion opened this issue May 2, 2022 · 1 comment
Assignees
Labels
api: datastore Issues related to the Datastore API. type: cleanup An internal cleanup or hygiene concern.

Comments

@telpirion
Copy link
Contributor

telpirion commented May 2, 2022

The Query.Filter() method takes a single string parameter that accepts both the field to query for and the operation to perform in the query. The current implementation uses strings.TrimRight() to separate out the field name from the operation, but this solution is problematic as we add more operators.

Source code

Possible solution

Ideally we would refactor Filter() to follow the idiom of Filter(fieldName, operation string, value interface{}), an idiom that is used in other Datastore clients.

Alternatives

Add a new improved Filter() method -- BetterFilter()? -- that uses the better idiom.

Context

This issue is more pronounced because we allow customers to pass in query strings with and without spaces between field names and operators.

@telpirion telpirion added the triage me I really want to be triaged. label May 2, 2022
@product-auto-label product-auto-label bot added the api: datastore Issues related to the Datastore API. label May 2, 2022
@telpirion telpirion added type: cleanup An internal cleanup or hygiene concern. and removed triage me I really want to be triaged. labels May 3, 2022
@telpirion telpirion self-assigned this May 3, 2022
@telpirion
Copy link
Contributor Author

This feature was already added with the FilterField() method ( #6017 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

1 participant