-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from SeaQL/find-linked-join-alias
`find_linked` join with table alias
- Loading branch information
Showing
11 changed files
with
194 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::entity::prelude::*; | ||
|
||
#[derive(Debug)] | ||
pub struct CakeToFilling; | ||
|
||
impl Linked for CakeToFilling { | ||
type FromEntity = super::cake::Entity; | ||
|
||
type ToEntity = super::filling::Entity; | ||
|
||
fn link(&self) -> Vec<RelationDef> { | ||
vec![ | ||
super::cake_filling::Relation::Cake.def().rev(), | ||
super::cake_filling::Relation::Filling.def(), | ||
] | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct CakeToFillingVendor; | ||
|
||
impl Linked for CakeToFillingVendor { | ||
type FromEntity = super::cake::Entity; | ||
|
||
type ToEntity = super::vendor::Entity; | ||
|
||
fn link(&self) -> Vec<RelationDef> { | ||
vec![ | ||
super::cake_filling::Relation::Cake.def().rev(), | ||
super::cake_filling::Relation::Filling.def(), | ||
super::filling::Relation::Vendor.def(), | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate as sea_orm; | ||
use crate::entity::prelude::*; | ||
|
||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] | ||
#[sea_orm(table_name = "vendor")] | ||
pub struct Model { | ||
#[sea_orm(primary_key)] | ||
pub id: i32, | ||
pub name: String, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, EnumIter)] | ||
pub enum Relation {} | ||
|
||
impl RelationTrait for Relation { | ||
fn def(&self) -> RelationDef { | ||
panic!() | ||
} | ||
} | ||
|
||
impl Related<super::filling::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
super::filling::Relation::Vendor.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters