actix-postgres

PostgreSQL integration for Actix framework.

Documentation

Features

Examples

```rust use actix::prelude::*; use actixpostgres::{bb8postgres::tokio_postgres::tls::NoTls, PostgresActor, PostgresMessage};

[actix_rt::main]

async fn main() { let path = std::env::var("PGPATH").unwrap(); let pgactor = PostgresActor::start(&path, NoTls).unwrap(); let task = PostgresMessage::new(|pool| { Box::pin(async move { let connection = pool.get().await?; connection .query("SELECT NOW()::TEXT as c", &vec![]) .await .maperr(|err| err.into()) }) }); let res = pgactor.send(task).await.unwrap().unwrap(); let val: &str = res[0].get(0); println!("{}", val); System::current().stop(); } ```