Struct async_graphql::dataloader::DataLoader [−][src]
This is supported on crate feature
dataloader
only.Data loader.
Reference: https://github.com/facebook/dataloader
Implementations
impl<T> DataLoader<T>
[src][−]
pub fn new(loader: T) -> Self
[src][−]
Create a DataLoader with the Loader
trait.
pub fn delay(self, delay: Duration) -> Self
[src][−]
Specify the delay time for loading data, the default is 1ms
.
pub fn max_batch_size(self, max_batch_size: usize) -> Self
[src][−]
pub fn Specify the max batch size for loading data, the default is 1000
.
If the keys waiting to be loaded reach the threshold, they are loaded immediately.
pub async fn load_one<K>(&self, key: K) -> Result<Option<T::Value>, T::Error> where
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
[src][−]
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
Use this DataLoader
load a data.
pub async fn load_many<K>(
&self,
keys: impl Iterator<Item = K>
) -> Result<HashMap<K, T::Value>, T::Error> where
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
[src][−]
&self,
keys: impl Iterator<Item = K>
) -> Result<HashMap<K, T::Value>, T::Error> where
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
Use this DataLoader
to load some data.
Auto Trait Implementations
impl<T> !RefUnwindSafe for DataLoader<T>
impl<T> Send for DataLoader<T> where
T: Send,
T: Send,
impl<T> Sync for DataLoader<T> where
T: Sync,
T: Sync,
impl<T> Unpin for DataLoader<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for DataLoader<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T> Instrument for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,