Skip to main content

prax_postgres/
lib.rs

1// QueryError is intentionally large; see prax-query/src/lib.rs.
2#![allow(clippy::result_large_err)]
3
4//! # prax-postgres
5//!
6//! PostgreSQL driver for the Prax ORM with connection pooling and prepared statement caching.
7//!
8//! This crate provides:
9//! - Connection pool management using `deadpool-postgres`
10//! - Prepared statement caching for improved performance
11//! - Type-safe parameter binding
12//! - Row deserialization into Prax models
13//!
14//! ## Example
15//!
16//! ```rust,ignore
17//! use prax_postgres::PgPool;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//!     // Create a connection pool
22//!     let pool = PgPool::builder()
23//!         .url("postgresql://user:pass@localhost/db")
24//!         .max_connections(10)
25//!         .build()
26//!         .await?;
27//!
28//!     // Get a connection
29//!     let conn = pool.get().await?;
30//!
31//!     Ok(())
32//! }
33//! ```
34
35pub(crate) mod capabilities;
36pub mod config;
37pub mod connection;
38pub mod deserialize;
39pub mod engine;
40pub mod error;
41pub mod pool;
42pub mod row;
43pub mod row_ref;
44pub mod statement;
45pub mod types;
46
47pub use config::{PgConfig, PgConfigBuilder};
48pub use connection::PgConnection;
49pub use engine::PgEngine;
50pub use error::{PgError, PgResult};
51pub use pool::{PgPool, PgPoolBuilder, PoolConfig, PoolStatus};
52pub use row::PgRow;
53pub use statement::PreparedStatementCache;
54
55/// Prelude for convenient imports.
56pub mod prelude {
57    pub use crate::config::{PgConfig, PgConfigBuilder};
58    pub use crate::connection::PgConnection;
59    pub use crate::engine::PgEngine;
60    pub use crate::error::{PgError, PgResult};
61    pub use crate::pool::{PgPool, PgPoolBuilder};
62    pub use crate::row::PgRow;
63}