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)
| 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. |
| 926 | func 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. |
no test coverage detected