Welcome to mirror list, hosted at ThFree Co, Russian Federation.

graphql_helpers.rb « helpers « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ddef0c16b38a0394a8f5f6fc8dd312ebd3a861d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module API
  module Helpers
    # GraphqlHelpers is used by the REST API when it is acting like a client
    # against the graphql API. Helper code for the graphql server implementation
    # should be in app/graphql/ or lib/gitlab/graphql/
    module GraphqlHelpers
      def run_graphql!(query:, context: {}, transform: nil)
        result = GitlabSchema.execute(query, context: context)

        if transform
          transform.call(result)
        else
          result
        end
      end
    end
  end
end