datastore: refactor Query.Filter()
to use separate parameters for field name and operation
#5977
Labels
api: datastore
Issues related to the Datastore API.
type: cleanup
An internal cleanup or hygiene concern.
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 usesstrings.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 ofFilter(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.
The text was updated successfully, but these errors were encountered: