objectify v6 - 不再支持 NOT 和 IN 过滤器?备择方案?
objectify v6 - NOT and IN filters no longer supported? Alternatives?
objectify v6 文档说:
NOT and IN filters are not supported by the new SDK. You will get a
runtime error if you try to
ofy().load().type(Thing.class).filter("field !=", value) or
filter("field IN" values).
即使在 objectify v5 中,我们是否应该远离使用 NOT 或 IN 过滤器,因为它们看起来正在退出?
是否有关于为什么这些不再受支持的信息?任何替代方法可能实现类似类型的查询?具体来说,IN 查询。 is/was 如果您说出需要查询所有内容的用户 ID 列表,这将非常有用。
无论如何,这些只是方便的过滤器,被转化为其他过滤器的组合。
The != (not-equal) and IN (membership) operations are implemented by
combining other filters using the OR operation. The first of these,
https://cloud.google.com/appengine/docs/standard/python/ndb/queries#neq_and_in
property != value
实现为 (property < value) OR (property > value)
property IN [value1, value2, ...]
实现为 (property == value1) OR (property == value2) OR ...
所以您可以将所有 !=
和 IN
过滤器转换为
objectify v6 文档说:
NOT and IN filters are not supported by the new SDK. You will get a runtime error if you try to ofy().load().type(Thing.class).filter("field !=", value) or filter("field IN" values).
即使在 objectify v5 中,我们是否应该远离使用 NOT 或 IN 过滤器,因为它们看起来正在退出?
是否有关于为什么这些不再受支持的信息?任何替代方法可能实现类似类型的查询?具体来说,IN 查询。 is/was 如果您说出需要查询所有内容的用户 ID 列表,这将非常有用。
无论如何,这些只是方便的过滤器,被转化为其他过滤器的组合。
The != (not-equal) and IN (membership) operations are implemented by combining other filters using the OR operation. The first of these,
https://cloud.google.com/appengine/docs/standard/python/ndb/queries#neq_and_in
property != value
实现为 (property < value) OR (property > value)
property IN [value1, value2, ...]
实现为 (property == value1) OR (property == value2) OR ...
所以您可以将所有 !=
和 IN
过滤器转换为