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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! # giong-postgres
//!
//! A PostgreSQL client and connection pool for the [giong] thread-per-core
//! runtime.
//!
//! ```no_run
//! use giong_postgres::{Client, Config};
//!
//! fn main() -> Result<(), giong_postgres::Error> {
//! let config = Config::from_url("postgres://app:secret@localhost/shop")?;
//! giong::block_on(async {
//! let client = Client::connect(&config).await?;
//! let rows = client
//! .query("SELECT id, name FROM products WHERE price < $1", &[&100i32])
//! .await?;
//! for row in &rows {
//! let id: i64 = row.get("id")?;
//! let name: &str = row.get("name")?;
//! println!("{id} {name}");
//! }
//! Ok(())
//! })
//! }
//! ```
//!
//! ## What it does
//!
//! * **Pipelining across tasks.** Tasks that share a connection send their
//! statements together, and one round trip answers all of them.
//! * **Prepared statements, kept.** Every statement is prepared the first
//! time a connection runs it and kept in a bounded cache, so it takes one
//! round trip from then on; parameters and results travel in binary.
//! * **A pool per worker** ([`Pool`]): no locks, no threads in between;
//! statements that stand alone share connections, transactions take one.
//! * **TLS** through `giong-tls` (rustls), on by default for remote hosts and
//! always checking the certificate. **SCRAM-SHA-256** (and MD5, and clear
//! text only over TLS or to this machine).
//! * **Errors that say what to do**, with the server's SQLSTATE code and
//! fields in [`DbError`].
//! * **Limits everywhere**, all finite and documented on [`Config`]: connect
//! timeout, statement timeout (enforced by the server), result size,
//! statement cache, pool wait.
//!
//! ## What it does not do (yet)
//!
//! `COPY`, `LISTEN`/`NOTIFY`, streaming rows one at a time, arrays and other
//! types beyond those listed in [`types`] (read them as strings), channel
//! binding (`SCRAM-SHA-256-PLUS`), several hosts with failover, and SASLprep
//! normalization of non-ASCII passwords.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// The TLS connector type, re-exported so that [`Tls::Verify`] can be built
/// without depending on `giong-tls` directly.
pub use TlsConnector;