pub struct MorphMany {
pub child_model: String,
pub morph_type_column: String,
pub morph_id_column: String,
pub morph_type_value: String,
}Expand description
多态一对多配置(父模型侧)
例:Post has many Comment,Comment 表中有 commentable_type(值为 “Post”)和 commentable_id 两列。
加载 Post.comments 时:SELECT * FROM comments WHERE commentable_type = 'Post' AND commentable_id = ?
Fields§
§child_model: String子模型表名(如 “comments”)
morph_type_column: String子表中标识父类型的列名(如 “commentable_type”)
morph_id_column: String子表中标识父主键的列名(如 “commentable_id”)
morph_type_value: String父模型类型标识字符串(如 “Post”)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MorphMany
impl RefUnwindSafe for MorphMany
impl Send for MorphMany
impl Sync for MorphMany
impl Unpin for MorphMany
impl UnsafeUnpin for MorphMany
impl UnwindSafe for MorphMany
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