Registry / database / tokio-postgres

tokio-postgres

JSON →
library0.7.18rscratesunverified

A native, asynchronous PostgreSQL client

# Cargo.toml [dependencies] tokio-postgres = "0.7.18"
INSTALL
IMPORT
SIG · TOKIO-POSTGRES
T
tokio-postgres
databaserustv0.7.18
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
✓ use tokio_postgres::Client;

Connect to a PostgreSQL database and run a query

use tokio_postgres::Client; #[tokio::main] async fn main() { let (client, connection) = tokio_postgres::connect("host=localhost user=postgres", tokio_postgres::NoTls).await.unwrap(); tokio::spawn(async move { connection.await.unwrap(); }); let rows = client.query("SELECT 1", &[]).await.unwrap(); println!("Query result: {:?}", rows); }
Debug
Known issues
gotchaRequires a Tokio runtime; will panic if used outside an async context.
fix
Use #[tokio::main] or manually create a Tokio runtime.
affects: >=0.7.0
Upgrade
Version history
0.7.18latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
tokio-postgres — cargo add tokio-postgres · libregistry