mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-07 09:44:43 +00:00

Inlined format args make code more readable, and code more compact. I ran this clippy command to fix most cases, and then cleaned up a few trailing commas and uncaught edge cases. ``` cargo clippy --bins --examples --benches --tests --lib --workspace --fix -- -A clippy::all -W clippy::uninlined_format_args ```
JSON Example
Setup
-
Declare the database URL
export DATABASE_URL="postgres://postgres:password@localhost/json"
-
Create the database.
$ sqlx db create
-
Run sql migrations
$ sqlx migrate run
Usage
Add a person
echo '{ "name": "John Doe", "age": 30 }' | cargo run -- add
or with extra keys
echo '{ "name": "Jane Doe", "age": 25, "array": ["string", true, 0] }' | cargo run -- add
List all people
cargo run