MCPcopy
hub / github.com/dgraph-io/dgraph / updateMutations

Function updateMutations

edgraph/server.go:926–947  ·  view source on GitHub ↗

updateMutations updates the mutation and replaces uid(var) and val(var) with their values or a blank node, in case of an upsert. We use the values stored in qc.uidRes and qc.valRes to update the mutation.

(qc *queryContext)

Source from the content-addressed store, hash-verified

924// their values or a blank node, in case of an upsert.
925// We use the values stored in qc.uidRes and qc.valRes to update the mutation.
926func updateMutations(qc *queryContext) error {
927 for i, condVar := range qc.condVars {
928 gmu := qc.gmuList[i]
929 if condVar != "" {
930 uids, ok := qc.uidRes[condVar]
931 if !(ok && len(uids) == 1) {
932 gmu.Set = nil
933 gmu.Del = nil
934 continue
935 }
936 }
937
938 if err := updateUIDInMutations(gmu, qc); err != nil {
939 return err
940 }
941 if err := updateValInMutations(gmu, qc); err != nil {
942 return err
943 }
944 }
945
946 return nil
947}
948
949// findMutationVars finds all the variables used in mutation block and stores them
950// qc.uidRes and qc.valRes so that we only look for these variables in query results.

Callers 1

doMutateMethod · 0.85

Calls 2

updateUIDInMutationsFunction · 0.85
updateValInMutationsFunction · 0.85

Tested by

no test coverage detected