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

Method isSimilar

query/query.go:383–416  ·  view source on GitHub ↗
(ssg *SubGraph)

Source from the content-addressed store, hash-verified

381)
382
383func (sg *SubGraph) isSimilar(ssg *SubGraph) bool {
384 if sg.Attr != ssg.Attr {
385 return false
386 }
387 if len(sg.Params.Langs) != len(ssg.Params.Langs) {
388 return false
389 }
390 for i := 0; i < len(sg.Params.Langs) && i < len(ssg.Params.Langs); i++ {
391 if sg.Params.Langs[i] != ssg.Params.Langs[i] {
392 return false
393 }
394 }
395 if sg.Params.DoCount {
396 return ssg.Params.DoCount
397 }
398 if ssg.Params.DoCount {
399 return false
400 }
401 if sg.SrcFunc != nil {
402 if ssg.SrcFunc != nil && sg.SrcFunc.Name == ssg.SrcFunc.Name {
403 return true
404 }
405 return false
406 }
407 // Below check doesn't differentiate between different filters.
408 // It is added to differential between `hasFriend` and `hasFriend @filter()`
409 if sg.Filters != nil {
410 if ssg.Filters != nil && len(sg.Filters) == len(ssg.Filters) {
411 return true
412 }
413 return false
414 }
415 return true
416}
417
418func isEmptyIneqFnWithVar(sg *SubGraph) bool {
419 return sg.SrcFunc != nil && isInequalityFn(sg.SrcFunc.Name) && len(sg.SrcFunc.Args) == 0 &&

Callers 1

expandSubgraphFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected