Struct async_graphql::dataloader::DataLoader [−][src]
pub struct DataLoader<T, C = NoCache> { /* fields omitted */ }
dataloader
only.Expand description
Data loader.
Reference: https://github.com/facebook/dataloader
Implementations
impl<T> DataLoader<T, NoCache>
[src]
impl<T> DataLoader<T, NoCache>
[src]pub fn new(loader: T) -> Self
[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]
impl<T, C: CacheFactory> DataLoader<T, C>
[src]pub fn with_cache(loader: T, cache_factory: C) -> Self
[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]
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 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]
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]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]
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]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]
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]Feed some data into 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
[src]
impl<T> FutureExt for T
[src]fn with_context(self, otel_cx: Context) -> WithContext<Self>
[src]
fn with_context(self, otel_cx: Context) -> WithContext<Self>
[src]fn with_current_context(self) -> WithContext<Self>
[src]
fn with_current_context(self) -> WithContext<Self>
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
impl<T> WithSubscriber for T
[src]fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
fn with_current_subscriber(self) -> WithDispatch<Self>
[src]
fn with_current_subscriber(self) -> WithDispatch<Self>
[src]Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more