Skip to content

Commit

Permalink
Improve example for Select::into_values
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Oct 1, 2021
1 parent d79419f commit 0c05b4c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/executor/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,29 +133,29 @@ where
/// # let db = MockDatabase::new(DbBackend::Postgres)
/// # .append_query_results(vec![vec![
/// # maplit::btreemap! {
/// # "name" => Into::<Value>::into("Chocolate Forest"),
/// # "cake_name" => Into::<Value>::into("Chocolate Forest"),
/// # "num_of_cakes" => Into::<Value>::into(1),
/// # },
/// # maplit::btreemap! {
/// # "name" => Into::<Value>::into("New York Cheese"),
/// # "cake_name" => Into::<Value>::into("New York Cheese"),
/// # "num_of_cakes" => Into::<Value>::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<String> = 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?;
///
Expand All @@ -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![]
/// ),]
/// );
Expand Down

0 comments on commit 0c05b4c

Please sign in to comment.