QueryGraphQL handles only GraphQL queries, neither mutations nor DQL.
(ctx context.Context, req *api.Request, field gqlSchema.Field)
| 1328 | |
| 1329 | // QueryGraphQL handles only GraphQL queries, neither mutations nor DQL. |
| 1330 | func (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 | |
| 1346 | func (s *Server) Query(ctx context.Context, req *api.Request) (*api.Response, error) { |
| 1347 | resp, err := s.QueryNoGrpc(ctx, req) |
no test coverage detected