dataloader
dataloader copied to clipboard
Pass association/batch_key to query function
Would it be possible to add the association name to the options passed to the query function when using a custom query? For example:
Dataloader.load(loader, Post, :replies, post)
would pass %{assoc_name: :replies}
or something similar to the opts parameter in the query function.
@Un3qual can you elaborate on your use case?
It would be useful to easily be able to have different behavior for the query function depending on which association I'm loading.
It's a lot less fragile if instead the options are passed in directly:
Dataloader.load(loader, Post, {:replies, %{some_option: true}}, post)