Sha256: 663f285b7270b7ee7f778eb9546ba9e0df754144b407ac2e3c6913284175991a

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module GraphQL::Batch
  class Query < QueryContainer
    def initialize(&block)
      @block = block
    end

    # batched queries with the same key are merged together
    def group_key
      self.class.name
    end

    def each_query
      yield self
    end

    def complete(result)
      if @block
        result = @block.call(result)
        @block = nil
      end
      super(result)
    end

    # execute queries, with the same group_key, as a batch
    def self.execute(queries)
      raise NotImplementedError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-batch-0.1.0 lib/graphql/batch/query.rb