Expand description
§prax-postgres
PostgreSQL driver for the Prax ORM with connection pooling and prepared statement caching.
This crate provides:
- Connection pool management using
deadpool-postgres - Prepared statement caching for improved performance
- Type-safe parameter binding
- Row deserialization into Prax models
§Example
ⓘ
use prax_postgres::PgPool;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a connection pool
let pool = PgPool::builder()
.url("postgresql://user:pass@localhost/db")
.max_connections(10)
.build()
.await?;
// Get a connection
let conn = pool.get().await?;
Ok(())
}Re-exports§
pub use config::PgConfig;pub use config::PgConfigBuilder;pub use connection::PgConnection;pub use engine::PgEngine;pub use error::PgError;pub use error::PgResult;pub use pool::PgPool;pub use pool::PgPoolBuilder;pub use pool::PoolConfig;pub use pool::PoolStatus;pub use row::PgRow;pub use statement::PreparedStatementCache;
Modules§
- config
- PostgreSQL connection configuration.
- connection
- PostgreSQL connection wrapper.
- engine
- PostgreSQL query engine implementation.
- error
- Error types for PostgreSQL operations.
- pool
- Connection pool for PostgreSQL.
- prelude
- Prelude for convenient imports.
- row
- PostgreSQL row types and deserialization.
- statement
- Prepared statement caching.
- types
- Type conversions for PostgreSQL.
Macros§
- impl_
from_ row - Macro to implement FromPgRow for simple structs.