mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-09-28 13:31:41 +00:00
parent
ce801b9330
commit
51954fed8c
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user