pub struct MorphTo {
pub morph_type_column: String,
pub morph_id_column: String,
}Expand description
多态反向配置(子模型侧)
例:Comment 属于 Post 或 Video,Comment 表中有 commentable_type + commentable_id。
加载 Comment.commentable 时,根据 commentable_type 路由到不同表。
Fields§
§morph_type_column: String当前模型中标识父类型的列名(如 “commentable_type”)
morph_id_column: String当前模型中标识父主键的列名(如 “commentable_id”)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MorphTo
impl RefUnwindSafe for MorphTo
impl Send for MorphTo
impl Sync for MorphTo
impl Unpin for MorphTo
impl UnsafeUnpin for MorphTo
impl UnwindSafe for MorphTo
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