Method: GraphQL::Dataloader::Source#request

Defined in:
lib/graphql/dataloader/source.rb

#request(value) ⇒ Dataloader::Request

Returns a pending request for a value from key. Call .load on that object to wait for the result.

Returns:

  • (Dataloader::Request)

    a pending request for a value from key. Call .load on that object to wait for the result.



21
22
23
24
25
26
27
# File 'lib/graphql/dataloader/source.rb', line 21

def request(value)
  res_key = result_key_for(value)
  if !@results.key?(res_key)
    @pending[res_key] ||= normalize_fetch_key(value)
  end
  Dataloader::Request.new(self, value)
end