From 0c05b4c34ef69ce2aac08dd1bfeb867dd6a28b47 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Fri, 1 Oct 2021 13:24:11 +0800 Subject: [PATCH] Improve example for `Select::into_values` --- src/executor/select.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/executor/select.rs b/src/executor/select.rs index 1285fe963..7a10488e8 100644 --- a/src/executor/select.rs +++ b/src/executor/select.rs @@ -133,29 +133,29 @@ where /// # let db = MockDatabase::new(DbBackend::Postgres) /// # .append_query_results(vec![vec![ /// # maplit::btreemap! { - /// # "name" => Into::::into("Chocolate Forest"), + /// # "cake_name" => Into::::into("Chocolate Forest"), /// # "num_of_cakes" => Into::::into(1), /// # }, /// # maplit::btreemap! { - /// # "name" => Into::::into("New York Cheese"), + /// # "cake_name" => Into::::into("New York Cheese"), /// # "num_of_cakes" => Into::::into(1), /// # }, /// # ]]) /// # .into_connection(); /// # - /// use sea_orm::{entity::*, query::*, tests_cfg::cake, EnumIter, DeriveIden, TryGetableMany}; + /// use sea_orm::{entity::*, query::*, tests_cfg::cake, DeriveColumn, EnumIter, TryGetableMany}; /// - /// #[derive(EnumIter, DeriveIden)] - /// enum ResultCol { - /// Name, + /// #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] + /// enum QueryAs { + /// CakeName, /// } /// /// # let _: Result<(), DbErr> = smol::block_on(async { /// # /// let res: Vec = cake::Entity::find() /// .select_only() - /// .column(cake::Column::Name) - /// .into_values::<_, ResultCol>() + /// .column_as(cake::Column::Name, QueryAs::CakeName) + /// .into_values::<_, QueryAs>() /// .all(&db) /// .await?; /// @@ -171,7 +171,7 @@ where /// db.into_transaction_log(), /// vec![Transaction::from_sql_and_values( /// DbBackend::Postgres, - /// r#"SELECT "cake"."name" FROM "cake""#, + /// r#"SELECT "cake"."name" AS "cake_name" FROM "cake""#, /// vec![] /// ),] /// );