mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00

* macros: Reduce I/O by doing all .env and environment variable reading inside a Lazy initializer. * Use the default runtime and TLS backend for all examples Before, rust-analyzer was always hitting the "only one runtime can be enabled" compile_error in sqlx-rt.
TODOs Example
Setup
-
Declare the database URL
export DATABASE_URL="mysql://root:password@localhost/todos"
-
Create the database.
$ sqlx db create
-
Run sql migrations
$ sqlx migrate run
Usage
Add a todo
cargo run -- add "todo description"
Complete a todo.
cargo run -- done <todo id>
List all todos
cargo run