mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
parent
214d5db494
commit
60d3e182b4
1 changed files with 6 additions and 1 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue