Versatile Dataloader
A dataloader (originally developed by facebook) allows to batch requests coming in at roughly the same time. This is useful e.g., to avoid the n+1 problem in GraphQL.
Forked/extracted from async-graphql as it has no dependencies towards async-graphql and might be useful on its own.
Example
use ;
use Infallible;
use ;
/// This loader simply converts the integer key into a string value.
;
new_current_thread.build.unwrap.block_on;
Related projects
- async-graphql includes a dataloder where this one is based on. We adapted the API to make the return type generic rather than an associated type. This allows to use one struct as a dataloader for different return types all with the same key (e.g., a UUID).
- dataloader-rs is similar, but it has a less versatile API that does not support errors.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.