Paolo Barbolini fc9c9be5e8
Update to edition 2021 (#1808)
* Update to edition 2021

* Fix running tests
2022-04-15 12:52:00 -07:00
..
2020-11-12 07:21:54 -08:00
2022-04-15 12:52:00 -07:00
2020-11-12 07:21:54 -08:00

JSON Example

Setup

  1. Declare the database URL

    export DATABASE_URL="postgres://postgres:password@localhost/json"
    
  2. Create the database.

    $ sqlx db create
    
  3. 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