Rename left_join_and_select_* to find_*_related

This commit is contained in:
Chris Tsang 2021-06-28 02:17:03 +08:00
parent 0a215f75ed
commit a0d9b47b1f
3 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,7 @@ async fn find_together(db: &DbConn) -> Result<(), QueryErr> {
print!("find cakes and fruits: ");
let both = Cake::find()
.left_join_and_select_also(Fruit)
.find_also_related(Fruit)
.all(db)
.await?;
@ -145,7 +145,7 @@ async fn find_many_to_many(db: &DbConn) -> Result<(), QueryErr> {
print!("find cakes and fillings: ");
let both: Vec<(cake::Model, Vec<filling::Model>)> = Cake::find()
.left_join_and_select_with(Filling)
.find_with_related(Filling)
.all(db)
.await?;
@ -217,7 +217,7 @@ async fn find_together_json(db: &DbConn) -> Result<(), QueryErr> {
print!("find cakes and fruits: ");
let cakes_fruits = Cake::find()
.left_join_and_select_with(Fruit)
.find_with_related(Fruit)
.into_json()
.all(db)
.await?;

View File

@ -21,7 +21,7 @@
//!
//! // find related models (eager)
//! let cake_with_fruits: Vec<(cake::Model, Vec<fruit::Model>)> = Cake::find()
//! .left_join_and_select_with(Fruit)
//! .find_with_related(Fruit)
//! .all(db)
//! .await?;
//!

View File

@ -41,7 +41,7 @@ where
}
/// 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
R: EntityTrait,
E: Related<R>,
@ -50,7 +50,7 @@ where
}
/// 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
R: EntityTrait,
E: Related<R>,