sal_postgresclient/lib.rs
1//! SAL PostgreSQL Client
2//!
3//! This crate provides a PostgreSQL client for interacting with PostgreSQL databases.
4//! It offers connection management, query execution, and a builder pattern for flexible configuration.
5//!
6//! ## Features
7//!
8//! - **Connection Management**: Automatic connection handling and reconnection
9//! - **Query Execution**: Simple API for executing queries and fetching results
10//! - **Builder Pattern**: Flexible configuration with authentication support
11//! - **Environment Variable Support**: Easy configuration through environment variables
12//! - **Thread Safety**: Safe to use in multi-threaded applications
13//! - **PostgreSQL Installer**: Install and configure PostgreSQL using nerdctl
14//! - **Rhai Integration**: Scripting support for PostgreSQL operations
15//!
16//! ## Usage
17//!
18//! ```rust,no_run
19//! use sal_postgresclient::{execute, query, query_one};
20//!
21//! fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! // Execute a query
23//! let rows_affected = execute("CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT)", &[])?;
24//!
25//! // Query data
26//! let rows = query("SELECT * FROM users", &[])?;
27//!
28//! // Query single row
29//! let row = query_one("SELECT * FROM users WHERE id = $1", &[&1])?;
30//!
31//! Ok(())
32//! }
33//! ```
34
35mod installer;
36mod postgresclient;
37pub mod rhai;
38
39// Re-export the public API
40pub use installer::*;
41pub use postgresclient::*;