func (m *MqlSession) GetQuery(input string, output_struct chan map[string]interface{}) { defer close(output_struct) var mqlQuery interface{} err := json.Unmarshal([]byte(input), &mqlQuery) if err != nil { return } m.currentQuery = NewMqlQuery(m) m.currentQuery.BuildIteratorTree(mqlQuery) output := make(map[string]interface{}) graph.OutputQueryShapeForIterator(m.currentQuery.it, m.ts, &output) nodes := output["nodes"].([]graph.Node) new_nodes := make([]graph.Node, 0) for _, n := range nodes { n.Tags = nil new_nodes = append(new_nodes, n) } output["nodes"] = new_nodes output_struct <- output }
func runIteratorOnSession(it graph.Iterator, ses *Session) { if ses.lookingForQueryShape { graph.OutputQueryShapeForIterator(it, ses.ts, &(ses.queryShape)) return } it, _ = it.Optimize() glog.V(2).Infoln(it.DebugString(0)) for { // TODO(barakmich): Better halting. if ses.doHalt { return } _, ok := it.Next() if !ok { break } tags := make(map[string]graph.TSVal) it.TagResults(&tags) cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags}) if !cont { break } for it.NextResult() == true { if ses.doHalt { return } tags := make(map[string]graph.TSVal) it.TagResults(&tags) cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags}) if !cont { break } } } it.Close() }