Comments (7)
Thank you for opening the issue!
call
is pretty generic
Yes, I agree. On the other hand, match_id
is too specific and assumes that the first argument is some kind of ID, which not always the case.
In general, loader
is just a "function" (lambda). That is why it is executed by using the standard Ruby load
method. Renaming it will require changing the data structure. And at the same time, I'd like to avoid making breaking changes, so we'd need to keep the compatibility with load
. But if you come up with some better names, feel free to share :)
from batch-loader.
How about...
lookup.call
matcher.call
connector.call
I could also imagine something fancier like set_target(target).from(source)
although I don't know how you'd get that working, not knowing the internals of all this!
from batch-loader.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
from batch-loader.
Still interested.
from batch-loader.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
from batch-loader.
Still interested
from batch-loader.
Thanks for your feedback!
lookup.call
matcher.call
connector.call
I think you can easily use any of the suggested names in your code since loader
is just the name of a local variable with a lambda
:
BatchLoader::GraphQL.for_id(post.user_id).batch do |user_ids, connector|
User.where(id: user_ids).each { |user| connector.load(user.id, user) }
end
I wouldn't go with anything fancier to keep it simple for now since it will require creating a more complicated loader
object vs simple lambda
. Maybe in the future :)
I am going to close the issue.
from batch-loader.
Related Issues (20)
- Possibility of deadlock HOT 2
- Extra computations for already loaded data happen when cache: false HOT 1
- How to get nested relation without n+1 on graphql ? HOT 4
- N+1 queries when batch loading has many association HOT 2
- Searchkick(elasticsearch) Object Associations HOT 2
- throwing undefined method `use' for BatchLoader::Middleware:Class HOT 4
- Using batch-loader to query a count of a has_many relation HOT 2
- batch-loader not working for non-nullable graphql fields, returns "Cannot return null for non-nullable field" HOT 14
- Warnings after updating to Ruby 2.7 HOT 3
- How I can filter associations values? HOT 2
- Wrong number of arguments (given 1, expected 0) HOT 6
- Loading across collections
- How to debug the code inside batch loader block HOT 1
- Erro on principal node is object
- BatchLoader::GraphQL with union type
- `BatchLoader.for().batch {}` evaluated as Truthy but should be Falsey HOT 5
- `BatchLoader::GraphQL.for` doesn't delegate missing methods as `BatchLoader.for` does
- Incompatibility with graphql-ruby 2.0.18+ HOT 2
- Why not to use `attr_accessor` for `batch_loader`? HOT 1
- Incompatibility with graphql-ruby 2.3.x HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from batch-loader.