diff --git a/SeaORM/docs/05-basic-crud/03-insert.md b/SeaORM/docs/05-basic-crud/03-insert.md index 9ed11418dc3..f370757aeee 100644 --- a/SeaORM/docs/05-basic-crud/03-insert.md +++ b/SeaORM/docs/05-basic-crud/03-insert.md @@ -177,7 +177,7 @@ let orange = fruit::ActiveModel { ..Default::default() }; -let res: InsertResult = Fruit::insert_many(vec![apple, orange]).exec(db).await?; +let res: InsertResult = Fruit::insert_many([apple, orange]).exec(db).await?; assert_eq!(res.last_insert_id, 30) ``` diff --git a/SeaORM/docs/05-basic-crud/07-json.md b/SeaORM/docs/05-basic-crud/07-json.md index d794d657015..5778e1e43c5 100644 --- a/SeaORM/docs/05-basic-crud/07-json.md +++ b/SeaORM/docs/05-basic-crud/07-json.md @@ -29,7 +29,7 @@ let cakes: Vec = Cake::find() assert_eq!( cakes, - vec![ + [ serde_json::json!({ "id": 2, "name": "Chocolate Forest" diff --git a/SeaORM/docs/05-basic-crud/08-raw-sql.md b/SeaORM/docs/05-basic-crud/08-raw-sql.md index 28be5eafafe..c99c31f5e95 100644 --- a/SeaORM/docs/05-basic-crud/08-raw-sql.md +++ b/SeaORM/docs/05-basic-crud/08-raw-sql.md @@ -9,7 +9,7 @@ let cheese: Option = cake::Entity::find() .from_raw_sql(Statement::from_sql_and_values( DbBackend::Postgres, r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE "id" = $1"#, - vec![1.into()], + [1.into()], )) .one(&db) .await?; @@ -26,7 +26,7 @@ pub struct UniqueCake { let unique: Vec = UniqueCake::find_by_statement(Statement::from_sql_and_values( DbBackend::Postgres, r#"SELECT "cake"."name" FROM "cake" GROUP BY "cake"."name"#, - vec![], + [], )) .all(&db) .await?; @@ -38,7 +38,7 @@ If you do not know what your model looks like beforehand, you can use `JsonValue let unique: Vec = JsonValue::find_by_statement(Statement::from_sql_and_values( DbBackend::Postgres, r#"SELECT "cake"."name" FROM "cake" GROUP BY "cake"."name"#, - vec![], + [], )) .all(&db) .await?; @@ -51,7 +51,7 @@ let mut cake_pages = cake::Entity::find() .from_raw_sql(Statement::from_sql_and_values( DbBackend::Postgres, r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE "id" = $1"#, - vec![1.into()], + [1.into()], )) .paginate(db, 50); @@ -71,7 +71,7 @@ assert_eq!( cake_filling::Entity::find_by_id((6, 8)) .build(DatabaseBackend::MySql) .to_string(), - vec![ + [ "SELECT `cake_filling`.`cake_id`, `cake_filling`.`filling_id` FROM `cake_filling`", "WHERE `cake_filling`.`cake_id` = 6 AND `cake_filling`.`filling_id` = 8", ].join(" ") diff --git a/SeaORM/docs/07-write-test/02-mock.md b/SeaORM/docs/07-write-test/02-mock.md index c1a6cb13c1f..4f07bcbdf60 100644 --- a/SeaORM/docs/07-write-test/02-mock.md +++ b/SeaORM/docs/07-write-test/02-mock.md @@ -76,7 +76,7 @@ mod tests { // Return the second query result assert_eq!( cake::Entity::find().all(&db).await?, - vec![ + [ cake::Model { id: 1, name: "New York Cheese".to_owned(), @@ -94,7 +94,7 @@ mod tests { .find_also_related(fruit::Entity) .all(&db) .await?, - vec![( + [( cake::Model { id: 1, name: "Apple Cake".to_owned(), @@ -110,21 +110,21 @@ mod tests { // Checking transaction log assert_eq!( db.into_transaction_log(), - vec![ + [ Transaction::from_sql_and_values( DatabaseBackend::Postgres, r#"SELECT "cake"."id", "cake"."name" FROM "cake" LIMIT $1"#, - vec![1u64.into()] + [1u64.into()] ), Transaction::from_sql_and_values( DatabaseBackend::Postgres, r#"SELECT "cake"."id", "cake"."name" FROM "cake""#, - vec![] + [] ), Transaction::from_sql_and_values( DatabaseBackend::Postgres, r#"SELECT "cake"."id" AS "A_id", "cake"."name" AS "A_name", "fruit"."id" AS "B_id", "fruit"."name" AS "B_name", "fruit"."cake_id" AS "B_cake_id" FROM "cake" LEFT JOIN "fruit" ON "cake"."id" = "fruit"."cake_id""#, - vec![] + [] ), ] ); @@ -194,16 +194,16 @@ mod tests { // Checking transaction log assert_eq!( db.into_transaction_log(), - vec![ + [ Transaction::from_sql_and_values( DatabaseBackend::Postgres, r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#, - vec!["Apple Pie".into()] + ["Apple Pie".into()] ), Transaction::from_sql_and_values( DatabaseBackend::Postgres, r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id""#, - vec!["Apple Pie".into()] + ["Apple Pie".into()] ), ] ); diff --git a/SeaORM/docs/08-advanced-query/01-custom-select.md b/SeaORM/docs/08-advanced-query/01-custom-select.md index daa6c8340b2..15ff2db8449 100644 --- a/SeaORM/docs/08-advanced-query/01-custom-select.md +++ b/SeaORM/docs/08-advanced-query/01-custom-select.md @@ -101,7 +101,7 @@ let res: Vec = cake::Entity::find() assert_eq!( res, - vec!["Chocolate Forest".to_owned(), "New York Cheese".to_owned()] + ["Chocolate Forest".to_owned(), "New York Cheese".to_owned()] ); ``` @@ -127,7 +127,7 @@ let res: Vec<(String, i64)> = cake::Entity::find() .all(&db) .await?; -assert_eq!(res, vec![("Chocolate Forest".to_owned(), 2i64)]); +assert_eq!(res, [("Chocolate Forest".to_owned(), 2i64)]); ``` Instead, the `into_tuple` method can be used to fetch the tuple value. diff --git a/SeaORM/docs/09-generate-sea-query-statement/01-create-table.md b/SeaORM/docs/09-generate-sea-query-statement/01-create-table.md index c727013a236..a4d21639593 100644 --- a/SeaORM/docs/09-generate-sea-query-statement/01-create-table.md +++ b/SeaORM/docs/09-generate-sea-query-statement/01-create-table.md @@ -67,7 +67,7 @@ To further illustrate it, we will show the SQL statement as string below. db_postgres.build(&schema.create_table_from_entity(CakeFillingPrice)), Statement::from_string( db_postgres, - vec![ + [ r#"CREATE TABLE "public"."cake_filling_price" ("#, r#""cake_id" integer NOT NULL,"#, r#""filling_id" integer NOT NULL,"#, @@ -92,7 +92,7 @@ To further illustrate it, we will show the SQL statement as string below. db_mysql.build(&schema.create_table_from_entity(CakeFillingPrice)), Statement::from_string( db_mysql, - vec![ + [ "CREATE TABLE `cake_filling_price` (", "`cake_id` int NOT NULL,", "`filling_id` int NOT NULL,", @@ -117,7 +117,7 @@ To further illustrate it, we will show the SQL statement as string below. db_sqlite.build(&schema.create_table_from_entity(CakeFillingPrice)), Statement::from_string( db_sqlite, - vec![ + [ "CREATE TABLE `cake_filling_price` (", "`cake_id` integer NOT NULL,", "`filling_id` integer NOT NULL,", diff --git a/SeaORM/docs/09-generate-sea-query-statement/02-create-enum.md b/SeaORM/docs/09-generate-sea-query-statement/02-create-enum.md index f8958f739c8..f648da14798 100644 --- a/SeaORM/docs/09-generate-sea-query-statement/02-create-enum.md +++ b/SeaORM/docs/09-generate-sea-query-statement/02-create-enum.md @@ -111,7 +111,7 @@ assert_eq!( .iter() .map(|stmt| db_postgres.build(stmt)) .collect::>(), - vec![Statement::from_string( + [Statement::from_string( db_postgres, r#"CREATE TYPE "tea" AS ENUM ('EverydayTea', 'BreakfastTea')"#.to_owned() ),] @@ -129,7 +129,7 @@ assert_eq!( db_postgres.build(&schema.create_table_from_entity(active_enum::Entity)), Statement::from_string( db_postgres, - vec![ + [ r#"CREATE TABLE "public"."active_enum" ("#, r#""id" serial NOT NULL PRIMARY KEY,"#, r#""tea" tea"#, @@ -154,7 +154,7 @@ assert_eq!( db_mysql.build(&schema.create_table_from_entity(active_enum::Entity)), Statement::from_string( db_mysql, - vec![ + [ "CREATE TABLE `active_enum` (", "`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,", "`tea` ENUM('EverydayTea', 'BreakfastTea')", @@ -179,7 +179,7 @@ assert_eq!( db_sqlite.build(&schema.create_enum_from_entity(active_enum::Entity)), Statement::from_string( db_sqlite, - vec![ + [ "CREATE TABLE `active_enum` (", "`id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,", "`tea` text",