fix(readme): link to dotenv crate

closes #1405
This commit is contained in:
Austin Bonander 2021-11-09 17:16:00 -08:00 committed by GitHub
parent ce801b9330
commit 51954fed8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -358,12 +358,14 @@ Differences from `query()`:
queries against; the database does not have to contain any data but must be the same
kind (MySQL, Postgres, etc.) and have the same schema as the database you will be connecting to at runtime.
For convenience, you can use a .env file to set DATABASE_URL so that you don't have to pass it every time:
For convenience, you can use [a `.env` file][dotenv] to set DATABASE_URL so that you don't have to pass it every time:
```
DATABASE_URL=mysql://localhost/my_database
```
[dotenv]: https://github.com/dotenv-rs/dotenv#examples
The biggest downside to `query!()` is that the output type cannot be named (due to Rust not
officially supporting anonymous records). To address that, there is a `query_as!()` macro that is
mostly identical except that you can name the output type.