docs.rs failed to build sqlx-d1-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
sqlx-d1-0.3.1
SQLx-D1 realizes "SQLx for Cloudflare D1" with compile-time SQL verification in Rust Cloudflare development !
Background
Miniflare's local D1 emulator is, essentially, just an .sqlite file.
This fact has been brought a lot of Rustaceans trying sqlx with sqlite feature for D1, but it's impossible because sqlx-sqlite contains a native dependency of SQLite driver.
SQLx-D1 works around this by loading sqlx-sqlite only in macro context and just providing a conversion layer between D1 and SQLx in library context.
Features
- SQLx interface for Cloudflare D1
- Batteries included,
sqlxis not needed in dependencies - Compile-time SQL verification
- by
sqlx-sqliteand miniflare's local D1 emulator - by query caches in
.sqlxdirectory ( offline mode )
- by
- No environment variable or
.envfile is needed- D1 emulator's location is fixed to
.wrangler/state/v3/d1/miniflare-D1DatabaseObject - falling back to offline mode when it doesn't exist and
.sqlxdirectory exists
- D1 emulator's location is fixed to
Unsupported features
- Transaction
- Let's wait for Cloudflare's side to support transation on D1 !
- Connection pool (
sqlx::Poolinternally requires Rust async runtime (tokio / asycn-std) and time implemetation of WASM runtime which is not done on Cloudflare Workers )- alternatively,
&sqlx_d1::D1ConnectionimplementsExecutor, not only&mutone.
- alternatively,
- derive
Type,Encode,Decode- maybe added if requested
- workaround if needed: add
sqlxto dependencies and use its ones
Example
# Cargo.toml
[]
= { = "0.1", = ["macros"] }
= { = "0.5", = ["d1"] }
= { = "1.0", = ["derive"] }
# wrangler.toml
[[]]
= "DB"
= "..."
= "..."
// src/lib.rs
async
LICENSE
SQLx-D1 is licensed under MIT LICENSE ( LICENSE or https://opensource.org/licenses/MIT ) .