Make quickstart actually quick

fixes #760
This commit is contained in:
Kezi 2020-10-22 14:43:23 +02:00 committed by Ryan Leckey
parent 214d5db494
commit 60d3e182b4
No known key found for this signature in database
GPG key ID: F8AA68C235AB08C9

View file

@ -169,6 +169,11 @@ sqlx = { version = "0.4.0", features = [ "runtime-async-std-native-tls" ] }
## Usage
### Quickstart
```
[dependencies]
sqlx = { version = "0.4.0-beta.1", features = [ "postgres" ] }
async-std = { version = "1.6", features = [ "attributes" ] }
```
```rust
use std::env;
@ -182,7 +187,7 @@ async fn main() -> Result<(), sqlx::Error> {
// Create a connection pool
let pool = PgPoolOptions::new()
.max_connections(5)
.connect(&env::var("DATABASE_URL")?).await?;
.connect("postgres://postgres:password@localhost/test").await?;
// Make a simple query to return the given parameter
let row: (i64,) = sqlx::query_as("SELECT $1")