func storeQuery() { // Collect all Post entities under User userid. p := store.NewQuery("userid").Collect("Post") p.Collect("Like") // Collect all Like entities for Post entities. // Collect all Comment entities, and Likes on those comments. p.Collect("Comment").Collect("Like") // Alternatively, collect everything via breadth first iteration. p = store.NewQuery("userid").UptoDepth(10) result, _ := p.Run() js, _ := result.ToJson() // Convert to JSON. fmt.Println(string(js)) // Optionally write to w http.ResponseWriter. // result.WriteJsonResponse(w) }
func (si SimpleIndexer) Regenerate(e x.Entity) (rdoc x.Doc) { rdoc.Id = e.Id rdoc.Kind = e.Kind rdoc.NanoTs = time.Now().UnixNano() // Used for versioning, to support concurrency. // Query store to get the entity, and all it's properties. result, _ := store.NewQuery(e.Id).Run() data := result.ToMap() rdoc.Data = data // Data field takes interface{}, so set to anything. return } // end_simple