pub struct BatchLoader { /* private fields */ }Expand description
Batch loader for efficient relationship loading
Implementations§
Source§impl BatchLoader
impl BatchLoader
Sourcepub fn with_config(config: BatchConfig) -> Self
pub fn with_config(config: BatchConfig) -> Self
Create a new batch loader with custom configuration
Sourcepub async fn load_batch<M: Model>(
&self,
ids: Vec<Value>,
table: &str,
connection: &PgPool,
) -> OrmResult<Vec<JsonValue>>
pub async fn load_batch<M: Model>( &self, ids: Vec<Value>, table: &str, connection: &PgPool, ) -> OrmResult<Vec<JsonValue>>
Load multiple records in batches
Sourcepub async fn load_relationships(
&self,
parent_type: &str,
parent_ids: Vec<Value>,
relationship_name: &str,
foreign_key: &str,
related_table: &str,
connection: &PgPool,
) -> OrmResult<HashMap<Value, Vec<JsonValue>>>
pub async fn load_relationships( &self, parent_type: &str, parent_ids: Vec<Value>, relationship_name: &str, foreign_key: &str, related_table: &str, connection: &PgPool, ) -> OrmResult<HashMap<Value, Vec<JsonValue>>>
Load relationships in batches with deduplication
Sourcepub async fn load_nested_relationships(
&self,
_root_table: &str,
root_ids: Vec<Value>,
relationship_path: &str,
connection: &PgPool,
) -> OrmResult<HashMap<Value, JsonValue>>
pub async fn load_nested_relationships( &self, _root_table: &str, root_ids: Vec<Value>, relationship_path: &str, connection: &PgPool, ) -> OrmResult<HashMap<Value, JsonValue>>
Load nested relationships with deep optimization
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the query cache
Sourcepub async fn cache_stats(&self) -> CacheStats
pub async fn cache_stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Clone for BatchLoader
impl Clone for BatchLoader
Source§fn clone(&self) -> BatchLoader
fn clone(&self) -> BatchLoader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BatchLoader
impl !RefUnwindSafe for BatchLoader
impl Send for BatchLoader
impl Sync for BatchLoader
impl Unpin for BatchLoader
impl !UnwindSafe for BatchLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more