From d9c9426e89465ec7ba1731a57c6d8879700e2ec6 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 7 Aug 2024 21:36:16 +0800 Subject: [PATCH 1/2] docs: Add an example for sqlx Signed-off-by: Xuanwo --- Cargo.toml | 3 ++- examples/sqlx.rs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 examples/sqlx.rs diff --git a/Cargo.toml b/Cargo.toml index dc283ef..81e3bf5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,5 @@ tokio = { version = "1", features = ["time"] } [dev-dependencies] anyhow = "1" reqwest = "0.12" -tokio = { version = "1", features = ["time", "rt", "macros", "sync"] } +tokio = { version = "1", features = ["time", "rt", "macros", "sync", "rt-multi-thread"] } +sqlx = { version = "0.8.0", features = ["runtime-tokio", "sqlite"] } \ No newline at end of file diff --git a/examples/sqlx.rs b/examples/sqlx.rs new file mode 100644 index 0000000..4eeea95 --- /dev/null +++ b/examples/sqlx.rs @@ -0,0 +1,20 @@ +use anyhow::Result; +use backon::ExponentialBuilder; +use backon::Retryable; +use sqlx::sqlite::SqlitePoolOptions; + +#[tokio::main] +async fn main() -> Result<()> { + let pool = SqlitePoolOptions::new() + .max_connections(5) + .connect("sqlite::memory:") + .await?; + + let row: (i64,) = (|| sqlx::query_as("SELECT $1").bind(150_i64).fetch_one(&pool)) + .retry(&ExponentialBuilder::default()) + .await?; + + assert_eq!(row.0, 150); + + Ok(()) +} From fefe2837eada80353a225a2664a9ec2d60b02d85 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 7 Aug 2024 21:38:20 +0800 Subject: [PATCH 2/2] remove audit Signed-off-by: Xuanwo --- .github/actions/check/action.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/actions/check/action.yml b/.github/actions/check/action.yml index dc35f38..9e754e6 100644 --- a/.github/actions/check/action.yml +++ b/.github/actions/check/action.yml @@ -13,17 +13,6 @@ runs: command: fmt args: --all -- --check - - name: Install cargo-audit - uses: actions-rs/cargo@v1 - with: - command: install - args: cargo-audit - - - name: Audit dependencies - uses: actions-rs/cargo@v1 - with: - command: audit - - name: Clippy uses: actions-rs/cargo@v1 with: