Skip to content

Feature Request: Dataloader for one to many relation #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abinash-mlbd opened this issue Nov 15, 2019 · 1 comment
Open

Feature Request: Dataloader for one to many relation #58

abinash-mlbd opened this issue Nov 15, 2019 · 1 comment

Comments

@abinash-mlbd
Copy link

abinash-mlbd commented Nov 15, 2019

For one to one relation dataloader woking perfectly.
Is there any way to generate dataloader for one to many relation ?
It will be great if dataloader for one to many relation also generated.
An example of one to many relation dataloader
https://medium.com/@gajus/using-dataloader-to-batch-requests-c345f4b23433

@jakubknejzlik
Copy link
Contributor

Hello @abinash-mlbd , currently there are no plans to create dataloader for toMany relationships. Mainly because we didn't need it yet :-) . Anyway I agree that it would be nice feature, but little refactoring would be required (also notes for myself):

  1. updating fetch query to be able to fetch related IDs (currently we fetch objects in separate query)
  2. reusing entity dataloader and passing these IDs

The biggest "issue" right now is the first point, I'm not sure if it's possible to fetch IDs of related objects in single query using gorm...in plain MySQL I would use something like GROUP_CONCAT to fetch all ID's in single query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants