mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-14 00:07:05 +00:00
745c5c3957
* Updated the README example with acquire connection Initially from reading the docs and examples I tried to use `&mut pool` instead of `&mut conn`. The compiler gave me an error that `Pool<MySql>` didn't implement `Executor`. I had to do a bit of digging and eventually just viewed the source of `Pool` to find `acquire()`, `try_acquire()` etc. I think this change makes it a bit easier for someone to get started. * Update README.md to reference initial pool declaration * Fixed compile issues and added examples of using &mut &pool |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md | ||
schema.sql |
TODOs Example
Usage
Declare the database URL:
export DATABASE_URL="postgres://postgres@localhost/todos"
Create the database:
createdb -U postgres todos
Load the database schema:
psql -d "$DATABASE_URL" -f ./schema.sql
Run:
- Add a todo:
cargo run -- add "todo description"
- Complete a todo:
cargo run -- done <todo id>
- List all todos:
cargo run