Registry / database / bb8-postgres

bb8-postgres

JSON →
library0.9.0rscratesunverified

Full-featured async (tokio-based) PostgreSQL connection pool, similar to r2d2.

# Cargo.toml [dependencies] bb8-postgres = "0.9.0"
INSTALL
IMPORT
SIG · BB8-POSTGRES
B
bb8-postgres
databaserustv0.9.0
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.

PostgresConnectionManager
use bb8_postgres::PostgresConnectionManager;

Creates a connection pool and executes a simple query.

use bb8_postgres::{bb8, PostgresConnectionManager}; use tokio_postgres::NoTls; #[tokio::main] async fn main() { let manager = PostgresConnectionManager::new_from_stringlike( "host=localhost user=postgres dbname=mydb", NoTls, ).unwrap(); let pool = bb8::Pool::builder().build(manager).await.unwrap(); let conn = pool.get().await.unwrap(); let row = conn.query_one("SELECT 1", &[]).await.unwrap(); println!("Result: {}", row.get::<_, i32>(0)); }
Debug
Known issues
gotchaRequires tokio runtime; not compatible with other async runtimes.
fix
Use `#[tokio::main]` or ensure a tokio runtime is active.
affects: >=0.9.0
Upgrade
Version history
0.9.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
bb8-postgres — cargo add bb8-postgres · libregistry