Registry / database / sqlx
library0.8.6rscratesunverified

The Rust SQL Toolkit: an async, pure Rust SQL crate with compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.

# Cargo.toml [dependencies] sqlx = "0.8.6"
INSTALL
IMPORT
SIG · SQLX
S
sqlx
databaserustv0.8.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

query
use sqlx::query;

Connect to an in-memory SQLite database and execute a compile-time checked query.

use sqlx::query; #[tokio::main] async fn main() -> Result<(), sqlx::Error> { let pool = sqlx::SqlitePool::connect("sqlite::memory:").await?; let row: (i64,) = query!("SELECT 1").fetch_one(&pool).await?; println!("Result: {}", row.0); Ok(()) }
Debug
Known issues
gotchaRequires a Tokio runtime for async operations
fix
Add tokio as a dependency and use #[tokio::main] or similar runtime
affects: >=0.8.0
gotchaCompile-time checked queries require a database connection at compile time
fix
Set DATABASE_URL environment variable or use query_as! with offline mode
affects: >=0.8.0
Upgrade
Version history
0.8.6latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
Resources
sqlx — cargo add sqlx · libregistry