Sha256: 0c2301b9bda3a6fdae0b5d7f9136e59af8d8821552710039268d8a6641c83d26

Contents?: true

Size: 1.41 KB

Versions: 21

Compression:

Stored size: 1.41 KB

Contents

require "graphql/query/serial_execution/execution_context"
require "graphql/query/serial_execution/value_resolution"
require "graphql/query/serial_execution/field_resolution"
require "graphql/query/serial_execution/operation_resolution"
require "graphql/query/serial_execution/selection_resolution"

module GraphQL
  class Query
    class SerialExecution
      # This is the only required method for an Execution strategy.
      # You could create a custom execution strategy and configure your schema to
      # use that custom strategy instead.
      #
      # @param ast_operation [GraphQL::Language::Nodes::OperationDefinition] The operation definition to run
      # @param root_type [GraphQL::ObjectType] either the query type or the mutation type
      # @param query_obj [GraphQL::Query] the query object for this execution
      # @return [Hash] a spec-compliant GraphQL result, as a hash
      def execute(ast_operation, root_type, query_object)
        irep_root = query_object.internal_representation[ast_operation.name]

        operation_resolution.new(
          irep_root,
          root_type,
          ExecutionContext.new(query_object, self)
        ).result
      end

      def field_resolution
        self.class::FieldResolution
      end

      def operation_resolution
        self.class::OperationResolution
      end

      def selection_resolution
        self.class::SelectionResolution
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
graphql-1.1.0 lib/graphql/query/serial_execution.rb
graphql-1.0.0 lib/graphql/query/serial_execution.rb
graphql-0.19.4 lib/graphql/query/serial_execution.rb
graphql-0.19.3 lib/graphql/query/serial_execution.rb
graphql-0.19.2 lib/graphql/query/serial_execution.rb
graphql-0.19.1 lib/graphql/query/serial_execution.rb
graphql-0.19.0 lib/graphql/query/serial_execution.rb
graphql-0.18.15 lib/graphql/query/serial_execution.rb
graphql-0.18.14 lib/graphql/query/serial_execution.rb
graphql-0.18.13 lib/graphql/query/serial_execution.rb
graphql-0.18.12 lib/graphql/query/serial_execution.rb
graphql-0.18.11 lib/graphql/query/serial_execution.rb
graphql-0.18.10 lib/graphql/query/serial_execution.rb
graphql-0.18.9 lib/graphql/query/serial_execution.rb
graphql-0.18.8 lib/graphql/query/serial_execution.rb
graphql-0.18.7 lib/graphql/query/serial_execution.rb
graphql-0.18.6 lib/graphql/query/serial_execution.rb
graphql-0.18.5 lib/graphql/query/serial_execution.rb
graphql-0.18.4 lib/graphql/query/serial_execution.rb
graphql-0.18.3 lib/graphql/query/serial_execution.rb