hschne/graphql-groups

View on GitHub
lib/graphql/groups/pending_query.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module GraphQL
  module Groups
    class PendingQuery
      attr_reader :key
      attr_reader :aggregate
      attr_reader :query

      def initialize(key, aggregate, proc)
        @key = Utils.wrap(key)
        @aggregate = Utils.wrap(aggregate)
        @query = proc
      end

      def execute
        result = @query.call
        QueryResult.new(@key, @aggregate, result)
      end
    end
  end
end