MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / transformVars

Method transformVars

query/query.go:1239–1260  ·  view source on GitHub ↗

transformVars transforms all the variables to the variable at the lowest level

(doneVars map[string]varValue, path []*SubGraph)

Source from the content-addressed store, hash-verified

1237
1238// transformVars transforms all the variables to the variable at the lowest level
1239func (sg *SubGraph) transformVars(doneVars map[string]varValue, path []*SubGraph) error {
1240 mNode := sg.MathExp
1241 mvarList := mNode.extractVarNodes()
1242 for i := range mvarList {
1243 mt := mvarList[i]
1244 curNode := doneVars[mt.Var]
1245 newMap, err := curNode.transformTo(path)
1246 if err != nil {
1247 return err
1248 }
1249
1250 // This is the result of setting the result of count(uid) to a variable.
1251 // Treat this value as a constant.
1252 if val, ok := newMap.Get(math.MaxUint64); ok && newMap.Len() == 1 {
1253 mt.Const = val
1254 continue
1255 }
1256
1257 mt.Val = newMap
1258 }
1259 return nil
1260}
1261
1262func (sg *SubGraph) valueVarAggregation(doneVars map[string]varValue, path []*SubGraph,
1263 parent *SubGraph) error {

Callers 1

valueVarAggregationMethod · 0.95

Calls 4

extractVarNodesMethod · 0.80
transformToMethod · 0.80
GetMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected