Add `DataLoader::loader` method. #441

This commit is contained in:
Sunli 2021-03-12 15:41:10 +08:00
parent 4f47703118
commit d37297bb06
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Add `DataLoader::loader` method. [#441](https://github.com/async-graphql/async-graphql/issues/441)
## [2.5.13] - 2021-03-09
- Support generics in Subscription types. [#438](https://github.com/async-graphql/async-graphql/pull/438)

View File

@ -158,6 +158,12 @@ impl<T> DataLoader<T> {
}
}
/// Get the loader.
#[inline]
pub fn loader(&self) -> &T {
&self.loader
}
/// Use this `DataLoader` load a data.
pub async fn load_one<K>(&self, key: K) -> Result<Option<T::Value>, T::Error>
where