Don't indirect map values
We already have reference behaviour, so this is not necessary. This change highlighted fairly baroque architecture in mql that deserves some attention; the use of channels is somewhat confusing. Also rename LastResult to Result.
This commit is contained in:
parent
b89d4f392c
commit
a1453da84e
15 changed files with 59 additions and 57 deletions
|
|
@ -156,7 +156,7 @@ func runIteratorToArray(it graph.Iterator, ses *Session, limit int) []map[string
|
|||
break
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
output = append(output, tagsToValueMap(tags, ses))
|
||||
count++
|
||||
if limit >= 0 && count >= limit {
|
||||
|
|
@ -167,7 +167,7 @@ func runIteratorToArray(it graph.Iterator, ses *Session, limit int) []map[string
|
|||
return nil
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
output = append(output, tagsToValueMap(tags, ses))
|
||||
count++
|
||||
if limit >= 0 && count >= limit {
|
||||
|
|
@ -213,7 +213,7 @@ func runIteratorWithCallback(it graph.Iterator, ses *Session, callback otto.Valu
|
|||
break
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
|
||||
val, _ = callback.Call(this.This, val)
|
||||
count++
|
||||
|
|
@ -225,7 +225,7 @@ func runIteratorWithCallback(it graph.Iterator, ses *Session, callback otto.Valu
|
|||
return
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
|
||||
val, _ = callback.Call(this.This, val)
|
||||
count++
|
||||
|
|
@ -254,7 +254,7 @@ func runIteratorOnSession(it graph.Iterator, ses *Session) {
|
|||
break
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags})
|
||||
if !cont {
|
||||
break
|
||||
|
|
@ -264,7 +264,7 @@ func runIteratorOnSession(it graph.Iterator, ses *Session) {
|
|||
return
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
it.TagResults(tags)
|
||||
cont := ses.SendResult(&GremlinResult{metaresult: false, err: "", val: nil, actualResults: &tags})
|
||||
if !cont {
|
||||
break
|
||||
|
|
|
|||
|
|
@ -93,18 +93,18 @@ func (s *Session) ExecInput(input string, c chan interface{}, limit int) {
|
|||
break
|
||||
}
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
c <- &tags
|
||||
it.TagResults(tags)
|
||||
c <- tags
|
||||
for it.NextResult() == true {
|
||||
tags := make(map[string]graph.TSVal)
|
||||
it.TagResults(&tags)
|
||||
c <- &tags
|
||||
it.TagResults(tags)
|
||||
c <- tags
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Session) ToText(result interface{}) string {
|
||||
tags := *(result.(*map[string]graph.TSVal))
|
||||
tags := result.(map[string]graph.TSVal)
|
||||
out := fmt.Sprintln("****")
|
||||
tagKeys := make([]string, len(tags))
|
||||
s.currentQuery.treeifyResult(tags)
|
||||
|
|
@ -127,7 +127,7 @@ func (s *Session) ToText(result interface{}) string {
|
|||
}
|
||||
|
||||
func (s *Session) BuildJson(result interface{}) {
|
||||
s.currentQuery.treeifyResult(*(result.(*map[string]graph.TSVal)))
|
||||
s.currentQuery.treeifyResult(result.(map[string]graph.TSVal))
|
||||
}
|
||||
|
||||
func (s *Session) GetJson() (interface{}, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue