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

Method QueryGraphQL

edgraph/server.go:1330–1344  ·  view source on GitHub ↗

QueryGraphQL handles only GraphQL queries, neither mutations nor DQL.

(ctx context.Context, req *api.Request,
	field gqlSchema.Field)

Source from the content-addressed store, hash-verified

1328
1329// QueryGraphQL handles only GraphQL queries, neither mutations nor DQL.
1330func (s *Server) QueryGraphQL(ctx context.Context, req *api.Request,
1331 field gqlSchema.Field) (*api.Response, error) {
1332 // Add a timeout for queries which don't have a deadline set. We don't want to
1333 // apply a timeout if it's a mutation, that's currently handled by flag
1334 // "txn-abort-after".
1335 if req.GetMutations() == nil && x.Config.QueryTimeout != 0 {
1336 if d, _ := ctx.Deadline(); d.IsZero() {
1337 var cancel context.CancelFunc
1338 ctx, cancel = context.WithTimeout(ctx, x.Config.QueryTimeout)
1339 defer cancel()
1340 }
1341 }
1342 // no need to attach namespace here, it is already done by GraphQL layer
1343 return s.doQuery(ctx, &Request{req: req, gqlField: field, doAuth: getAuthMode(ctx)})
1344}
1345
1346func (s *Server) Query(ctx context.Context, req *api.Request) (*api.Response, error) {
1347 resp, err := s.QueryNoGrpc(ctx, req)

Callers 1

ExecuteMethod · 0.80

Calls 3

doQueryMethod · 0.95
getAuthModeFunction · 0.85
GetMutationsMethod · 0.80

Tested by

no test coverage detected