In Python it's
q = db.Query()
q.ancestor(ancestor_key)
I tried:
q := datastore.NewQuery("")
q.Ancestor(ancestor_key)
I get the error "datastore: empty kind" when running GetAll
I also tried:
q := &datastore.Query{}
q.Ancestor(ancestor_key)
I get the error "datastore: empty query kind"
Thanks in advance for any help with this matter.
Rich Churcher's comment seems to be right, at least at this point in time.
I don't think the Python kindless ancestor query is supported in Go. For a moment there I thought you could use the ancestor key's Kind() method, then I had some more coffee and came to my senses.
func NewQuery(kind string) *Query
NewQuery creates a new Query for a specific entity kind. The kind must be non-empty.
In your code,
q := datastore.NewQuery("")
the kind is empty.
GetAll doesn't seem to work, but you can do kindless queries.
ctx := appengine.NewContext(r)
q := datastore.NewQuery("")
for it := q.Run(ctx); ; {
key, err := t.Next(nil)
if err == datastore.Done {
break
}
if err != nil {
break
}
fmt.Printf("%v
", key)
}