db-sqlx-tester

Crates.iodb-sqlx-tester
lib.rsdb-sqlx-tester
version0.1.1
sourcesrc
created_at2023-03-31 13:52:09.881533
updated_at2023-04-01 02:30:56.250981
descriptionlearn from tyrchen
homepagehttps://github.com/tyrchen/
repositoryhttps://github.com/tyrchen/
max_upload_size
id826398
size19,683
WmW (nullptr-z)

documentation

https://docs.rs/

README

db-sqlx-tester

这是一个用 postgres 测试 sqlx 的工具。 目前它只支持 tokio runtime。

How to use it

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;
}
Commit count: 0

cargo fmt