{"id":33934286,"url":"https://github.com/eaze/tide-sqlx","last_synced_at":"2026-04-02T01:44:22.566Z","repository":{"id":39727018,"uuid":"314033378","full_name":"eaze/tide-sqlx","owner":"eaze","description":"Tide middleware for SQLx pooled connections \u0026 transactions","archived":false,"fork":false,"pushed_at":"2021-12-06T23:55:21.000Z","size":48,"stargazers_count":40,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"latest","last_synced_at":"2025-12-14T01:14:13.231Z","etag":null,"topics":["middleware","postgres-transactions","sqlx","tide"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/tide-sqlx","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eaze.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":"Contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-18T19:13:58.000Z","updated_at":"2024-07-21T18:28:15.000Z","dependencies_parsed_at":"2022-09-26T20:40:36.353Z","dependency_job_id":null,"html_url":"https://github.com/eaze/tide-sqlx","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/eaze/tide-sqlx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaze%2Ftide-sqlx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaze%2Ftide-sqlx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaze%2Ftide-sqlx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaze%2Ftide-sqlx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eaze","download_url":"https://codeload.github.com/eaze/tide-sqlx/tar.gz/refs/heads/latest","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaze%2Ftide-sqlx/sbom","scorecard":{"id":364430,"data":{"date":"2025-08-11","repo":{"name":"github.com/eaze/tide-sqlx","commit":"a252312ec874ff1b91a641cb21ac6435ae6988a8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/eaze/tide-sqlx/ci.yml/latest?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/eaze/tide-sqlx/ci.yml/latest?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'latest'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T11:32:11.978Z","repository_id":39727018,"created_at":"2025-08-18T11:32:11.978Z","updated_at":"2025-08-18T11:32:11.978Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"ssl_error","status_checked_at":"2026-04-02T01:43:36.474Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["middleware","postgres-transactions","sqlx","tide"],"created_at":"2025-12-12T13:34:04.457Z","updated_at":"2026-04-02T01:44:22.559Z","avatar_url":"https://github.com/eaze.png","language":"Rust","readme":"# tide-sqlx\n\n[Tide][] middleware for [SQLx][] pooled connections \u0026amp; transactions.\n\n----\n\nA [Tide][] middleware which holds a pool of SQLx database connections, and automatically hands\neach [tide::Request][] a connection, which may transparently be either a database transaction,\nor a direct pooled database connection.\n\nBy default, transactions are used for all http methods other than `GET` and `HEAD`.\n\nWhen using this, use the `SQLxRequestExt` extenstion trait to get the connection.\n\n## Examples\n\n### Basic\n```rust\n#[async_std::main]\nasync fn main() -\u003e anyhow::Result\u003c()\u003e {\n    use sqlx::Acquire; // Or sqlx::prelude::*;\n    use sqlx::postgres::Postgres;\n\n    use tide_sqlx::SQLxMiddleware;\n    use tide_sqlx::SQLxRequestExt;\n\n    let mut app = tide::new();\n    app.with(SQLxMiddleware::\u003cPostgres\u003e::new(\"postgres://localhost/a_database\").await?);\n\n    app.at(\"/\").post(|req: tide::Request\u003c()\u003e| async move {\n        let mut pg_conn = req.sqlx_conn::\u003cPostgres\u003e().await;\n\n        sqlx::query(\"SELECT * FROM users\")\n            .fetch_optional(pg_conn.acquire().await?)\n            .await;\n\n        Ok(\"\")\n    });\n    Ok(())\n}\n```\n\n### From sqlx `PoolOptions` and with `ConnectOptions`\n```rust\n#[async_std::main]\nasync fn main() -\u003e anyhow::Result\u003c()\u003e {\n    use log::LevelFilter;\n    use sqlx::{Acquire, ConnectOptions}; // Or sqlx::prelude::*;\n    use sqlx::postgres::{PgConnectOptions, PgPoolOptions, Postgres};\n\n    use tide_sqlx::SQLxMiddleware;\n    use tide_sqlx::SQLxRequestExt;\n\n    let mut connect_opts = PgConnectOptions::new();\n    connect_opts.log_statements(LevelFilter::Debug);\n\n    let pg_pool = PgPoolOptions::new()\n        .max_connections(5)\n        .connect_with(connect_opts)\n        .await?;\n\n    let mut app = tide::new();\n    app.with(SQLxMiddleware::from(pg_pool));\n\n    app.at(\"/\").post(|req: tide::Request\u003c()\u003e| async move {\n        let mut pg_conn = req.sqlx_conn::\u003cPostgres\u003e().await;\n\n        sqlx::query(\"SELECT * FROM users\")\n            .fetch_optional(pg_conn.acquire().await?)\n            .await;\n\n        Ok(\"\")\n    });\n    Ok(())\n}\n```\n\n## Why you may want to use this\n\nDatabase transactions are very useful because they allow easy, assured rollback if something goes wrong.\nHowever, transactions incur extra runtime cost which is too expensive to justify for READ operations that _do not need_ this behavior.\n\nIn order to allow transactions to be used seamlessly in endpoints, this middleware manages a transaction if one is deemed desirable.\n\n## License\n\nLicensed under the [BlueOak Model License 1.0.0](LICENSE.md) — _[Contributions via DCO 1.1](contributing.md#developers-certificate-of-origin)_\n\n[tide::Request]: https://docs.rs/tide/0.15.0/tide/struct.Request.html\n[SQLx]: https://github.com/launchbadge/sqlx\n[Tide]: https://github.com/http-rs/tide\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feaze%2Ftide-sqlx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feaze%2Ftide-sqlx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feaze%2Ftide-sqlx/lists"}