Crates/Sqlx
7 articles
How to use sqlx crate in Rust async SQL
Initialize a SQLx connection pool with tokio runtime features and execute async queries using .await.
How to Use sqlx for Async Database Access in Rust
TITLE: How to Use sqlx for Async Database Access in Rust
How to Use sqlx for Compile-Time Checked SQL Queries
Use `sqlx::query!` or `sqlx::query_as!` macros to compile-time check SQL syntax and column types against your database schema.
How to use SQLx in Rust
Add SQLx with runtime features, create a connection pool, and run async queries to interact with your database in Rust.
How to use SQLx with Axum
Connect Axum to SQLx by injecting a PgPool into handlers using the State extractor.
How to Write and Run Migrations with sqlx
Generate new migration files with sqlx migrate add and apply them to your database using sqlx migrate run.
How to Write Compile-Time Checked Queries with sqlx
Use sqlx macros like query! to validate SQL syntax and types at compile time, preventing runtime database errors.