Method: GraphQL::Dataloader::Source#fetch

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

#fetch(keys) ⇒ Array<Object>

Subclasses must implement this method to return a value for each of keys

Parameters:

Returns:

  • (Array<Object>)

    A loaded value for each of keys. The array must match one-for-one to the list of keys.



98
99
100
101
# File 'lib/graphql/dataloader/source.rb', line 98

def fetch(keys)
  # somehow retrieve these from the backend
  raise "Implement `#{self.class}#fetch(#{keys.inspect}) to return a record for each of the keys"
end