mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-14 16:17:15 +00:00
a824e8468c
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 ``` |
||
---|---|---|
.. | ||
migrations | ||
queries | ||
src | ||
Cargo.toml | ||
README.md |
Query files Example
Description
This example demonstrates storing external files to use for querying data. Encapsulating your SQL queries can be helpful in several ways, assisting with intellisense, etc.
Setup
-
Declare the database URL
export DATABASE_URL="postgres://postgres:password@localhost/files"
-
Create the database.
$ sqlx db create
-
Run sql migrations
$ sqlx migrate run
Usage
Run the project
cargo run files