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 mod config;
36pub mod connection;
37pub mod deserialize;
38pub mod engine;
39pub mod error;
40pub mod pool;
41pub mod row;
42pub mod row_ref;
43pub mod statement;
44pub mod types;
45
46pub use config::{PgConfig, PgConfigBuilder};
47pub use connection::PgConnection;
48pub use engine::PgEngine;
49pub use error::{PgError, PgResult};
50pub use pool::{PgPool, PgPoolBuilder, PoolConfig, PoolStatus};
51pub use row::PgRow;
52pub use statement::PreparedStatementCache;
53
54/// Prelude for convenient imports.
55pub mod prelude {
56    pub use crate::config::{PgConfig, PgConfigBuilder};
57    pub use crate::connection::PgConnection;
58    pub use crate::engine::PgEngine;
59    pub use crate::error::{PgError, PgResult};
60    pub use crate::pool::{PgPool, PgPoolBuilder};
61    pub use crate::row::PgRow;
62}