Packages / rupm

rs-db-driver-postgresql-tokio-postgres 0.1.0

PostgreSQL: tokio-postgres (the driver, re-exported, with a runnable example)

Install

cargo add rs-db-driver-postgresql-tokio-postgres --registry rupm

In Ruststudio: Packages, search for rs-db-driver-postgresql-tokio-postgres, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-db-driver-postgresql-tokio-postgres

PostgreSQL - tokio-postgres: async driver

Add it with `rupm add rs-db-driver-postgresql-tokio-postgres` (or `cargo add rs-db-driver-postgresql-tokio-postgres --registry rupm`). The driver `tokio-postgres` is re-exported as `rs_db_driver_postgresql_tokio_postgres::tokio_postgres`.

Also serves: CockroachDB, YugabyteDB, TimescaleDB, Amazon Aurora PostgreSQL

This driver is async: your project also needs an async runtime, for example `cargo add tokio --features macros,rt-multi-thread`.

## Example

```rust
use tokio_postgres::{Error, NoTls};

#[tokio::main]
async fn main() -> Result<(), Error> {
    let (client, connection) = tokio_postgres::connect("host=localhost user=postgres password=password dbname=mydb", NoTls).await?;
    // The connection object does the actual talking; run it on its own task.
    tokio::spawn(async move {
        if let Err(e) = connection.await {
            eprintln!("connection error: {e}");
        }
    });
    let rows = client.query("SELECT 1::INT4", &[]).await?;
    let value: i32 = rows[0].get(0);
    println!("the server answered {value}");
    Ok(())
}
```