pub struct BelongsToMany {
pub junction_table: String,
pub foreign_key: String,
pub other_key: String,
pub target_model: String,
pub target_pk: String,
}Expand description
多对多关系配置
关联语义:
junction_table:中间表名(如user_roles)foreign_key:中间表中指向当前模型主键的列名(如user_id)other_key:中间表中指向目标模型主键的列名(如role_id)target_model:目标表名(如roles)target_pk:目标表的主键列名(如id),用于 JOIN 条件t.{target_pk} = j.{other_key}
Fields§
§junction_table: String§foreign_key: String§other_key: String§target_model: String§target_pk: StringTrait Implementations§
Source§impl Clone for BelongsToMany
impl Clone for BelongsToMany
Source§fn clone(&self) -> BelongsToMany
fn clone(&self) -> BelongsToMany
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BelongsToMany
impl RefUnwindSafe for BelongsToMany
impl Send for BelongsToMany
impl Sync for BelongsToMany
impl Unpin for BelongsToMany
impl UnsafeUnpin for BelongsToMany
impl UnwindSafe for BelongsToMany
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