rusty_postgres/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pub use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
pub use postgres::types::ToSql;
pub use postgres::{
    tls::{MakeTlsConnect, TlsConnect},
    Error, NoTls, Socket,
};
pub use rand::Rng;
pub use std::collections::BTreeMap;
pub use std::fs::DirBuilder;
pub use std::fs::File;
pub use std::io;
pub use std::io::Write;
pub use std::panic;
pub use uuid::Uuid;

pub use rand::distributions::Alphanumeric;
pub use serde::{Deserialize, Serialize};
pub mod method;
// pub mod tests;

pub struct Client;

impl Client {
    pub fn connect<T>(client: &str, tls_mode: T) -> Result<postgres::Client, Error>
    where
        T: MakeTlsConnect<Socket> + 'static + Send,
        T::TlsConnect: Send,
        T::Stream: Send,
        <T::TlsConnect as TlsConnect<Socket>>::Future: Send,
    {
        let client = postgres::Client::connect(client, tls_mode);
        client
    }
}