pub struct Postgres { /* private fields */ }
Implementations§
Source§impl Postgres
impl Postgres
Sourcepub async fn connect(self) -> Result<(Client, Driver), Error>
pub async fn connect(self) -> Result<(Client, Driver), Error>
Connect to database, returning Client and Driver on success
§Examples:
use std::future::IntoFuture;
use xitca_postgres::{Execute, Postgres};
let cfg = String::from("postgres://user:pass@localhost/db");
let (client, driver) = Postgres::new(cfg).connect().await.unwrap();
// spawn driver as async task.
tokio::spawn(driver.into_future());
// use client for query.
"SELECT 1".execute(&client).await.unwrap();
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Postgres
impl !RefUnwindSafe for Postgres
impl Send for Postgres
impl Sync for Postgres
impl Unpin for Postgres
impl !UnwindSafe for Postgres
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more