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

Method Resolve

graphql/resolve/mutation.go:174–199  ·  view source on GitHub ↗
(ctx context.Context, m schema.Mutation)

Source from the content-addressed store, hash-verified

172}
173
174func (mr *dgraphResolver) Resolve(ctx context.Context, m schema.Mutation) (*Resolved, bool) {
175 span := trace.SpanFromContext(ctx)
176 stop := x.SpanTimer(span, "resolveMutation")
177 defer stop()
178 if span != nil {
179 span.AddEvent("Mutation Started", trace.WithAttributes(
180 attribute.String("Mutation alias", m.Alias()),
181 attribute.String("Type", m.MutatedType().DgraphName()),
182 ))
183 }
184
185 resolverTrace := &schema.ResolverTrace{
186 Path: []interface{}{m.ResponseName()},
187 ParentType: "Mutation",
188 FieldName: m.ResponseName(),
189 ReturnType: m.Type().String(),
190 }
191 timer := newtimer(ctx, &resolverTrace.OffsetDuration)
192 timer.Start()
193 defer timer.Stop()
194
195 resolved, success := mr.rewriteAndExecute(ctx, m)
196 resolverTrace.Dgraph = resolved.Extensions.Tracing.Execution.Resolvers[0].Dgraph
197 resolved.Extensions.Tracing.Execution.Resolvers[0] = resolverTrace
198 return resolved, success
199}
200
201func getNumUids(m schema.Mutation, a map[string]string, r map[string]interface{}) int {
202 switch m.MutationType() {

Callers

nothing calls this directly

Calls 11

rewriteAndExecuteMethod · 0.95
SpanTimerFunction · 0.92
newtimerFunction · 0.85
AliasMethod · 0.65
DgraphNameMethod · 0.65
MutatedTypeMethod · 0.65
ResponseNameMethod · 0.65
TypeMethod · 0.65
StartMethod · 0.65
StopMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected