sqlx/examples/postgres/files
Yuri Astrakhan a824e8468c
Cleanup format arguments (#2650)
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
```
2023-07-31 13:27:04 -07:00
..
migrations Add example with external query files (#1967) 2022-07-13 14:45:34 -07:00
queries Add example with external query files (#1967) 2022-07-13 14:45:34 -07:00
src Cleanup format arguments (#2650) 2023-07-31 13:27:04 -07:00
Cargo.toml 0.7.0 release (#2575) 2023-07-03 14:37:37 -07:00
README.md Add example with external query files (#1967) 2022-07-13 14:45:34 -07:00

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

  1. Declare the database URL

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

    $ sqlx db create
    
  3. Run sql migrations

    $ sqlx migrate run
    

Usage

Run the project

cargo run files