本文整理汇总了Golang中Graph.Iterator.TagResults方法的典型用法代码示例。如果您正苦于以下问题:Golang Iterator.TagResults方法的具体用法?Golang Iterator.TagResults怎么用?Golang Iterator.TagResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph.Iterator
的用法示例。
在下文中一共展示了Iterator.TagResults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: runIteratorWithCallback
func runIteratorWithCallback(it graph.Iterator, ses *GremlinSession, callback otto.Value, this otto.FunctionCall, limit int) {
count := 0
it, _ = it.Optimize()
for {
if ses.doHalt {
return
}
_, ok := it.Next()
if !ok {
break
}
tags := make(map[string]graph.TSVal)
it.TagResults(&tags)
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
val, _ = callback.Call(this.This, val)
count++
if limit >= 0 && count >= limit {
break
}
for it.NextResult() == true {
if ses.doHalt {
return
}
tags := make(map[string]graph.TSVal)
it.TagResults(&tags)
val, _ := this.Otto.ToValue(tagsToValueMap(tags, ses))
val, _ = callback.Call(this.This, val)
count++
if limit >= 0 && count >= limit {
break
}
}
}
it.Close()
}
示例2: runIteratorToArray
func runIteratorToArray(it graph.Iterator, ses *GremlinSession, limit int) []map[string]string {
output := make([]map[string]string, 0)
count := 0
it, _ = it.Optimize()
for {
if ses.doHalt {
return nil
}
_, ok := it.Next()
if !ok {
break
}
tags := make(map[string]graph.TSVal)
it.TagResults(&tags)
output = append(output, tagsToValueMap(tags, ses))
count++
if limit >= 0 && count >= limit {
break
}
for it.NextResult() == true {
if ses.doHalt {
return nil
}
tags := make(map[string]graph.TSVal)
it.TagResults(&tags)
output = append(output, tagsToValueMap(tags, ses))
count++
if limit >= 0 && count >= limit {
break
}
}
}
it.Close()
return output
}
示例3: runIteratorOnSession
func runIteratorOnSession(it graph.Iterator, ses *GremlinSession) {
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()
}