pgwire_lite/
lib.rs

1// src/lib.rs
2
3//! # PgWire Lite
4//!
5//! A lightweight PostgreSQL wire protocol client library built on top of libpq.
6//!
7//! This crate provides a simple, efficient interface for executing queries against
8//! PostgreSQL-compatible servers, including StackQL and similar services.
9//!
10//! ## Features
11//!
12//! - Built on the robust libpq C library
13//! - Simple API for query execution
14//! - Comprehensive error handling with configurable verbosity
15//! - Support for SSL/TLS connections
16//! - Detailed query result information including notices
17//!
18//! ## Example
19//!
20//! ```rust
21//! use pgwire_lite::PgwireLite;
22//!
23//! fn main() -> Result<(), Box<dyn std::error::Error>> {
24//!     // Create a connection to PGWire protocol server (like a local StackQL server)
25//!     let conn = PgwireLite::new("localhost", 5444, false, "default")?;
26//!     
27//!     // Execute a multi-line query using a raw string
28//!     let result = conn.query(r#"
29//!         SELECT region, instance_type, COUNT(*) as num_instances
30//!         FROM aws.ec2.instances
31//!         WHERE region = 'us-east-1'
32//!         GROUP BY instance_type
33//!     "#)?;
34//!     
35//!     // Process the result
36//!     println!("Instance types in us-east-1:");
37//!     for row in &result.rows {
38//!         println!(
39//!             "  {}: {} instances",
40//!             row.get("instance_type").unwrap(),
41//!             row.get("num_instances").unwrap()
42//!         );
43//!     }
44//!     
45//!     Ok(())
46//! }
47//! ```
48
49pub mod connection;
50pub mod notices;
51pub mod value;
52
53// Re-export types from the connection module
54pub use connection::{PgwireLite, QueryResult};
55
56// Re-export types from the notices module
57pub use notices::{Notice, Verbosity};
58
59// Re-export the Value type
60pub use value::Value;