通过在GAE数据存储区中指定值列表来查询实体

In my Datastore, I would like to query some entities by specifying as Filter the values of the same property. For instance I have the Entity named Foo defined as follows:

type Foo struct { Id int64 Name string CreatorId int64 }

And I want to retrieve all the Foo entities which have 1, 5, 23 as CreatorId. So I define the following query:

q := datastore.NewQuery("Foo").Filter("CreatorId =", 1).Filter("CreatorId =", 5).Filter("CreatorId =", 23)

But zero entity has been fetched. I looked into the documentation (https://developers.google.com/appengine/docs/go/datastore/reference) but it is not explained how to achieve this kind of query.

Some help will be greatly appreciated.

Java and Python allow you to run a query for a value in a collection (IN query). Under the surface, however, this query is executed as a series of EQUALS queries. It's a little less code, but no difference performance-wise, than to run regular EQUALS query in a loop.