graphql / dataloader

DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a consistent API over various backends and reduce requests to those backends via batching and caching.
MIT License
12.89k stars 515 forks source link

[REQUEST] return Object instead of map of a arguments in batchFn #274

Open jmvtrinidad opened 3 years ago

jmvtrinidad commented 3 years ago

What problem are you trying to solve?

Use object in batchFn return instead of function.

Describe the solution you'd like

The user should be able to return an object which contains the key as a cacheKey and its return value as a return. This can improve perf for very large requests/args. instead of mapping the the args with the result, the user can now create an object from the result.

Describe alternatives you've considered

Additional context

Mapping the args for a very few results from the backend is time-consuming.