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

Function filterCopy

query/query.go:458–489  ·  view source on GitHub ↗
(sg *SubGraph, ft *dql.FilterTree)

Source from the content-addressed store, hash-verified

456}
457
458func filterCopy(sg *SubGraph, ft *dql.FilterTree) error {
459 // Either we'll have an operation specified, or the function specified.
460 if len(ft.Op) > 0 {
461 sg.FilterOp = ft.Op
462 } else {
463 sg.Attr = ft.Func.Attr
464 if !isValidFuncName(ft.Func.Name) {
465 return errors.Errorf("Invalid function name: %s", ft.Func.Name)
466 }
467
468 if isUidFnWithoutVar(ft.Func) {
469 sg.SrcFunc = &Function{Name: ft.Func.Name}
470 if err := sg.populate(ft.Func.UID); err != nil {
471 return err
472 }
473 } else {
474 if ft.Func.Attr == "uid" {
475 return errors.Errorf(`Argument cannot be "uid"`)
476 }
477 sg.createSrcFunction(ft.Func)
478 sg.Params.NeedsVar = append(sg.Params.NeedsVar, ft.Func.NeedsVar...)
479 }
480 }
481 for _, ftc := range ft.Child {
482 child := &SubGraph{}
483 if err := filterCopy(child, ftc); err != nil {
484 return err
485 }
486 sg.Filters = append(sg.Filters, child)
487 }
488 return nil
489}
490
491func uniqueKey(gchild *dql.GraphQuery) string {
492 key := gchild.Attr

Callers 2

treeCopyFunction · 0.85
newGraphFunction · 0.85

Calls 5

isValidFuncNameFunction · 0.85
isUidFnWithoutVarFunction · 0.85
populateMethod · 0.80
createSrcFunctionMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…