| Crates.io | db-sqlx-tester |
| lib.rs | db-sqlx-tester |
| version | 0.1.1 |
| created_at | 2023-03-31 13:52:09.881533+00 |
| updated_at | 2023-04-01 02:30:56.250981+00 |
| description | learn from tyrchen |
| homepage | https://github.com/tyrchen/ |
| repository | https://github.com/tyrchen/ |
| max_upload_size | |
| id | 826398 |
| size | 19,683 |
这是一个用 postgres 测试 sqlx 的工具。 目前它只支持 tokio runtime。
You should first create a TestDb data Structure in your tests. It wil automatically create a database and a connection pool for you.
您应该首先在测试中创建一个 TestDb 数据结构。 它会自动为你创建一个数据库和一个连接池。
#[tokio::test]
fn some_awesom_test(){
let tdb = TestDb::new("localhost",5432,"postgres","postgres","./migrations");
let pool = tdb.get_pool().await;
}