pub struct ResultMap {
pub id: String,
pub type_name: String,
pub id_mappings: Vec<Mapping>,
pub result_mappings: Vec<Mapping>,
pub associations: Vec<NestedAssociation>,
pub collections: Vec<NestedCollection>,
pub discriminator: Option<Discriminator>,
}Expand description
完整结果映射规则
Fields§
§id: String唯一 id
type_name: String目标类型名(如 “User”)
id_mappings: Vec<Mapping>主键字段映射(用于唯一性判断、collection 聚合)
result_mappings: Vec<Mapping>普通字段映射
associations: Vec<NestedAssociation>一对一嵌套映射
collections: Vec<NestedCollection>一对多嵌套映射
discriminator: Option<Discriminator>多态鉴别器
Implementations§
Source§impl ResultMap
impl ResultMap
Sourcepub fn add_id_mapping(&mut self, mapping: Mapping) -> &mut Self
pub fn add_id_mapping(&mut self, mapping: Mapping) -> &mut Self
添加主键映射
Sourcepub fn add_result_mapping(&mut self, mapping: Mapping) -> &mut Self
pub fn add_result_mapping(&mut self, mapping: Mapping) -> &mut Self
添加普通字段映射
Sourcepub fn add_association(&mut self, assoc: NestedAssociation) -> &mut Self
pub fn add_association(&mut self, assoc: NestedAssociation) -> &mut Self
添加 association 嵌套
Sourcepub fn add_collection(&mut self, coll: NestedCollection) -> &mut Self
pub fn add_collection(&mut self, coll: NestedCollection) -> &mut Self
添加 collection 嵌套
Sourcepub fn set_discriminator(&mut self, disc: Discriminator) -> &mut Self
pub fn set_discriminator(&mut self, disc: Discriminator) -> &mut Self
设置 discriminator
Sourcepub fn sub_map_ids(&self) -> Vec<String>
pub fn sub_map_ids(&self) -> Vec<String>
收集本 ResultMap 直接引用的所有 sub-ResultMap id
Trait Implementations§
impl StructuralPartialEq for ResultMap
Auto Trait Implementations§
impl Freeze for ResultMap
impl RefUnwindSafe for ResultMap
impl Send for ResultMap
impl Sync for ResultMap
impl Unpin for ResultMap
impl UnsafeUnpin for ResultMap
impl UnwindSafe for ResultMap
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