pub struct RelationLoader { /* private fields */ }Expand description
预编译关系集合的批量加载器。
Implementations§
Source§impl RelationLoader
impl RelationLoader
Sourcepub fn new(relations: Vec<RelationSpec>) -> Self
pub fn new(relations: Vec<RelationSpec>) -> Self
创建批量加载器。
Sourcepub fn plan(&self, rows: &[Record]) -> Vec<RelationBatch>
pub fn plan(&self, rows: &[Record]) -> Vec<RelationBatch>
从结果行收集并去重外键,每种关系最多形成一个 batch。
Sourcepub async fn load<E>(
&self,
rows: &[Record],
executor: &E,
) -> Result<RelationData, BaseError>where
E: RelationBatchExecutor,
pub async fn load<E>(
&self,
rows: &[Record],
executor: &E,
) -> Result<RelationData, BaseError>where
E: RelationBatchExecutor,
执行批量加载;调用次数等于非空关系批次数,与输入行数无关。
Trait Implementations§
Source§impl Clone for RelationLoader
impl Clone for RelationLoader
Source§impl Debug for RelationLoader
impl Debug for RelationLoader
Auto Trait Implementations§
impl Forget for RelationLoader
impl Freeze for RelationLoader
impl Move for RelationLoader
impl RefUnwindSafe for RelationLoader
impl Send for RelationLoader
impl Sync for RelationLoader
impl Unpin for RelationLoader
impl UnsafeUnpin for RelationLoader
impl UnwindSafe for RelationLoader
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