zero_postgres/
lib.rs

1//! A high-performance PostgreSQL client library.
2//!
3//! # Features
4//!
5//! - **Zero-copy parsing**: Message payloads are parsed directly from the read buffer
6//! - **Sans-I/O state machines**: Protocol logic is separated from I/O
7//! - **Sync and async APIs**: Choose between synchronous and tokio-based async
8//! - **Full protocol support**: Simple query, extended query, COPY, pipelining
9//!
10//! # Example
11//!
12//! ```no_run
13//! use zero_postgres::sync::Conn;
14//! use zero_postgres::Opts;
15//!
16//! fn main() -> zero_postgres::Result<()> {
17//!     let opts = Opts {
18//!         host: "localhost".into(),
19//!         user: "postgres".into(),
20//!         database: Some("mydb".into()),
21//!         password: Some("secret".into()),
22//!         ..Default::default()
23//!     };
24//!
25//!     let mut conn = Conn::new(opts)?;
26//!
27//!     let rows: Vec<(i32,)> = conn.query_collect("SELECT 1 AS num")?;
28//!     println!("Rows: {:?}", rows);
29//!
30//!     conn.close()?;
31//!     Ok(())
32//! }
33//! ```
34
35// private
36mod buffer_pool;
37mod buffer_set;
38mod error;
39mod opts;
40mod pipeline;
41mod statement;
42
43// pub
44pub mod conversion;
45pub mod handler;
46pub mod protocol;
47pub mod state;
48
49#[cfg(feature = "sync")]
50pub mod sync;
51
52#[cfg(feature = "tokio")]
53pub mod tokio;
54
55#[cfg(feature = "derive")]
56pub use zero_postgres_derive as r#macro;
57
58pub use buffer_pool::BufferPool;
59pub use buffer_set::BufferSet;
60pub use error::{Error, Result, ServerError};
61pub use handler::AsyncMessageHandler;
62pub use opts::{Opts, SslMode};
63pub use pipeline::Ticket;
64pub use state::action::AsyncMessage;
65pub use state::extended::PreparedStatement;
66pub use statement::IntoStatement;