Rename left_join_and_select_* to find_*_related
This commit is contained in:
parent
0a215f75ed
commit
a0d9b47b1f
@ -67,7 +67,7 @@ async fn find_together(db: &DbConn) -> Result<(), QueryErr> {
|
|||||||
print!("find cakes and fruits: ");
|
print!("find cakes and fruits: ");
|
||||||
|
|
||||||
let both = Cake::find()
|
let both = Cake::find()
|
||||||
.left_join_and_select_also(Fruit)
|
.find_also_related(Fruit)
|
||||||
.all(db)
|
.all(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ async fn find_many_to_many(db: &DbConn) -> Result<(), QueryErr> {
|
|||||||
print!("find cakes and fillings: ");
|
print!("find cakes and fillings: ");
|
||||||
|
|
||||||
let both: Vec<(cake::Model, Vec<filling::Model>)> = Cake::find()
|
let both: Vec<(cake::Model, Vec<filling::Model>)> = Cake::find()
|
||||||
.left_join_and_select_with(Filling)
|
.find_with_related(Filling)
|
||||||
.all(db)
|
.all(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ async fn find_together_json(db: &DbConn) -> Result<(), QueryErr> {
|
|||||||
print!("find cakes and fruits: ");
|
print!("find cakes and fruits: ");
|
||||||
|
|
||||||
let cakes_fruits = Cake::find()
|
let cakes_fruits = Cake::find()
|
||||||
.left_join_and_select_with(Fruit)
|
.find_with_related(Fruit)
|
||||||
.into_json()
|
.into_json()
|
||||||
.all(db)
|
.all(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
//!
|
//!
|
||||||
//! // find related models (eager)
|
//! // find related models (eager)
|
||||||
//! let cake_with_fruits: Vec<(cake::Model, Vec<fruit::Model>)> = Cake::find()
|
//! let cake_with_fruits: Vec<(cake::Model, Vec<fruit::Model>)> = Cake::find()
|
||||||
//! .left_join_and_select_with(Fruit)
|
//! .find_with_related(Fruit)
|
||||||
//! .all(db)
|
//! .all(db)
|
||||||
//! .await?;
|
//! .await?;
|
||||||
//!
|
//!
|
||||||
|
@ -41,7 +41,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Left Join with a Related Entity and select both Entity.
|
/// Left Join with a Related Entity and select both Entity.
|
||||||
pub fn left_join_and_select_also<R>(self, r: R) -> SelectTwo<E, R>
|
pub fn find_also_related<R>(self, r: R) -> SelectTwo<E, R>
|
||||||
where
|
where
|
||||||
R: EntityTrait,
|
R: EntityTrait,
|
||||||
E: Related<R>,
|
E: Related<R>,
|
||||||
@ -50,7 +50,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Left Join with a Related Entity and select the related Entity as a `Vec`
|
/// Left Join with a Related Entity and select the related Entity as a `Vec`
|
||||||
pub fn left_join_and_select_with<R>(self, r: R) -> SelectTwoMany<E, R>
|
pub fn find_with_related<R>(self, r: R) -> SelectTwoMany<E, R>
|
||||||
where
|
where
|
||||||
R: EntityTrait,
|
R: EntityTrait,
|
||||||
E: Related<R>,
|
E: Related<R>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user