I am messing with GAE for go recently and found it misses fundamental != (not equal to) filter in their datastore API.
https://developers.google.com/appengine/docs/go/datastore/queries#Go_Property_filters
It also has no "OR" condition operand.
Could anyone tell me how could I filter data which is not equal to something?
even the languages that DO have the "!=" filter actually break it down into two inequality filters (one > and one <). Maybe doing the equivalent will solve your problem?
select * from table where param != "test"
becomes equal to
select * from table where param > "test"
merged with the results of
select * from table where param < "test"
not ideal, but given the limitations of the platform... I think it's your only choice.
From the page you linked there's actually an example of how to do that kind of queries.
From Restrictions on queries:
Inequality filters are limited to at most one property
To avoid having to scan the entire index table, the query mechanism relies on all of a query's potential results being adjacent to one another in the index. To satisfy this constraint, a single query may not use inequality comparisons (<, <=, >, >=) on more than one property across all of its filters. For example, the following query is valid, because both inequality filters apply to the same property:
q := datastore.NewQuery("Person").
Filter("BirthYear >=", minBirthYear).
Filter("BirthYear <=", maxBirthYear)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With