debian-mirror-gitlab/lib/api/helpers/graphql_helpers.rb
2019-12-21 20:55:43 +05:30

20 lines
546 B
Ruby

# 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