We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
async fn
1 parent 41ffc2c commit d7d1e4aCopy full SHA for d7d1e4a
atcoder-problems-backend/sql-client/tests/utils/mod.rs
@@ -1,7 +1,6 @@
1
use sql_client::PgPool;
2
use sqlx::Executor;
3
-use std::fs::File;
4
-use std::io::prelude::*;
+use tokio::fs;
5
6
const SQL_FILE: &str = "../../config/database-definition.sql";
7
const SQL_URL_ENV_KEY: &str = "SQL_URL";
@@ -30,9 +29,7 @@ pub async fn initialize_and_connect_to_test_sql() -> PgPool {
30
29
}
31
32
async fn initialize(pool: &PgPool) {
33
- let mut file = File::open(SQL_FILE).unwrap();
34
- let mut sql = String::new();
35
- file.read_to_string(&mut sql).unwrap();
+ let sql = fs::read_to_string(SQL_FILE).await.unwrap();
36
let mut conn = pool.acquire().await.unwrap();
37
conn.execute(sql.as_str()).await.unwrap();
38
0 commit comments