From a0d9b47b1fc4f90479624b7cea284ef075e3969f Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Mon, 28 Jun 2021 02:17:03 +0800 Subject: [PATCH] Rename left_join_and_select_* to find_*_related --- examples/sqlx-mysql/src/select.rs | 6 +++--- src/lib.rs | 2 +- src/query/join.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/sqlx-mysql/src/select.rs b/examples/sqlx-mysql/src/select.rs index 6057671e..0fe9c921 100644 --- a/examples/sqlx-mysql/src/select.rs +++ b/examples/sqlx-mysql/src/select.rs @@ -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)> = 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?; diff --git a/src/lib.rs b/src/lib.rs index dc7720ff..35571f42 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ //! //! // find related models (eager) //! let cake_with_fruits: Vec<(cake::Model, Vec)> = Cake::find() -//! .left_join_and_select_with(Fruit) +//! .find_with_related(Fruit) //! .all(db) //! .await?; //! diff --git a/src/query/join.rs b/src/query/join.rs index e3dc6dfb..4481f5af 100644 --- a/src/query/join.rs +++ b/src/query/join.rs @@ -41,7 +41,7 @@ where } /// Left Join with a Related Entity and select both Entity. - pub fn left_join_and_select_also(self, r: R) -> SelectTwo + pub fn find_also_related(self, r: R) -> SelectTwo where R: EntityTrait, E: Related, @@ -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(self, r: R) -> SelectTwoMany + pub fn find_with_related(self, r: R) -> SelectTwoMany where R: EntityTrait, E: Related,