Struct async_graphql::dataloader::DataLoader [−][src]
dataloader
only.Data loader.
Reference: https://github.com/facebook/dataloader
Implementations
impl<T> DataLoader<T, NoCache>
[src]
pub fn new(loader: T) -> Self
[src]
Use Loader
to create a DataLoader that does not cache records.
impl<T, C: CacheFactory> DataLoader<T, C>
[src]
pub fn with_cache(loader: T, cache_factory: C) -> Self
[src]
Use Loader
to create a DataLoader with a cache factory.
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 fn loader(&self) -> &T
[src]
Get the loader.
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, I>(
&self,
keys: I
) -> Result<HashMap<K, T::Value>, T::Error> where
K: Send + Sync + Hash + Eq + Clone + 'static,
I: IntoIterator<Item = K>,
T: Loader<K>,
[src]
&self,
keys: I
) -> Result<HashMap<K, T::Value>, T::Error> where
K: Send + Sync + Hash + Eq + Clone + 'static,
I: IntoIterator<Item = K>,
T: Loader<K>,
Use this DataLoader
to load some data.
pub async fn feed_many<K, I>(&self, values: I) where
K: Send + Sync + Hash + Eq + Clone + 'static,
I: IntoIterator<Item = (K, T::Value)>,
T: Loader<K>,
[src]
K: Send + Sync + Hash + Eq + Clone + 'static,
I: IntoIterator<Item = (K, T::Value)>,
T: Loader<K>,
Feed some data into the cache.
**NOTE: If the cache type is NoCache, this function will not take effect. **
pub async fn feed_one<K>(&self, key: K, value: T::Value) where
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
[src]
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
Feed some data into the cache.
**NOTE: If the cache type is NoCache, this function will not take effect. **
pub fn clear<K>(&self) where
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
[src]
K: Send + Sync + Hash + Eq + Clone + 'static,
T: Loader<K>,
Clears the cache.
**NOTE: If the cache type is NoCache, this function will not take effect. **
Auto Trait Implementations
impl<T, C> RefUnwindSafe for DataLoader<T, C> where
C: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for DataLoader<T, C> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<T, C> Sync for DataLoader<T, C> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,
impl<T, C> Unpin for DataLoader<T, C> where
C: Unpin,
T: Unpin,
C: Unpin,
T: Unpin,
impl<T, C> UnwindSafe for DataLoader<T, C> where
C: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
T: UnwindSafe,
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FutureExt for T
[src]
pub fn with_context(self, otel_cx: Context) -> WithContext<Self>
[src]
pub fn with_current_context(self) -> WithContext<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[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>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,