MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / uniqueKey

Function uniqueKey

query/query.go:491–527  ·  view source on GitHub ↗
(gchild *dql.GraphQuery)

Source from the content-addressed store, hash-verified

489}
490
491func uniqueKey(gchild *dql.GraphQuery) string {
492 key := gchild.Attr
493 if gchild.Func != nil {
494 key += fmt.Sprintf("%v", gchild.Func)
495 }
496 // This is the case when we ask for a variable.
497 if gchild.Attr == "val" {
498 // E.g. a as age, result is returned as var(a)
499 switch {
500 case gchild.Var != "" && gchild.Var != "val":
501 key = fmt.Sprintf("val(%v)", gchild.Var)
502 case len(gchild.NeedsVar) > 0:
503 // For var(s)
504 key = fmt.Sprintf("val(%v)", gchild.NeedsVar[0].Name)
505 }
506
507 // Could be min(var(x)) && max(var(x))
508 if gchild.Func != nil {
509 key += gchild.Func.Name
510 }
511 }
512 if gchild.IsCount { // ignore count subgraphs..
513 key += "count"
514 }
515 if len(gchild.Langs) > 0 {
516 key += fmt.Sprintf("%v", gchild.Langs)
517 }
518 if gchild.MathExp != nil {
519 // We would only be here if Alias is empty, so Var would be non
520 // empty because MathExp should have atleast one of them.
521 key = fmt.Sprintf("val(%+v)", gchild.Var)
522 }
523 if gchild.IsGroupby {
524 key += "groupby"
525 }
526 return key
527}
528
529func treeCopy(gq *dql.GraphQuery, sg *SubGraph) error {
530 // Typically you act on the current node, and leave recursion to deal with

Callers 1

treeCopyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…