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