Although our actual requirement is slightly more complicated, I would really love to hear some opinions on this:
Lets say my datastore entities are like so:
type BlogCategory struct {
Slug string
Name string
}
type BlogPost struct {
Slug string
Title string
Featured bool
Tags []string
}
BlogPost
have BlogCategory
as their parent. So each BlogCategory
has zero or more BlogPost
.
Q: Now, I want to write a datastore query which returns all the featured blog posts, across all the categories.
I realise that I could have just made category a property in the BlogPost
kind, but I wanted ancestor queries in the first place to get consistent results in my test cases.
Are there any more elegant ways of tackling this? I have a bunch of solutions in mind, but thought I would ask the hive mind before committing to one path.