(sg *SubGraph, ft *dql.FilterTree)
| 456 | } |
| 457 | |
| 458 | func 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 | |
| 491 | func uniqueKey(gchild *dql.GraphQuery) string { |
| 492 | key := gchild.Attr |
no test coverage detected
searching dependent graphs…