{"id":27054743,"url":"https://github.com/stackql/pgwire-lite-rs","last_synced_at":"2026-03-10T07:04:15.473Z","repository":{"id":286044530,"uuid":"959433400","full_name":"stackql/pgwire-lite-rs","owner":"stackql","description":"Lightweight PostgreSQL wire protocol client library for Rust, providing direct, low-level access to the PostgreSQL protocol.","archived":false,"fork":false,"pushed_at":"2025-04-15T07:05:01.000Z","size":27827,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T09:34:12.096Z","etag":null,"topics":["mtls","pgwire","pgwire-protocol","postgres","postgresql","protocol-client","rust","rust-crate","rust-lang","rust-library","ssl","stackql","wire-protocol"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-02T19:21:04.000Z","updated_at":"2025-04-15T07:05:06.000Z","dependencies_parsed_at":"2025-04-09T19:12:21.394Z","dependency_job_id":null,"html_url":"https://github.com/stackql/pgwire-lite-rs","commit_stats":null,"previous_names":["stackql/pgwire-lite-rs"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/stackql/pgwire-lite-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackql%2Fpgwire-lite-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackql%2Fpgwire-lite-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackql%2Fpgwire-lite-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackql%2Fpgwire-lite-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackql","download_url":"https://codeload.github.com/stackql/pgwire-lite-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackql%2Fpgwire-lite-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30326893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mtls","pgwire","pgwire-protocol","postgres","postgresql","protocol-client","rust","rust-crate","rust-lang","rust-library","ssl","stackql","wire-protocol"],"created_at":"2025-04-05T09:16:46.536Z","updated_at":"2026-03-10T07:04:15.453Z","avatar_url":"https://github.com/stackql.png","language":"Rust","readme":"# pgwire-lite-rs\n\n[![Crates.io](https://img.shields.io/crates/v/pgwire-lite.svg)](https://crates.io/crates/pgwire-lite)\n[![Documentation](https://docs.rs/pgwire-lite/badge.svg)](https://docs.rs/pgwire-lite)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA lightweight PostgreSQL wire protocol client library for Rust.\n\n## Overview\n\n**pgwire-lite** provides a simple, efficient interface for executing queries against PostgreSQL-compatible servers, including StackQL and other wire-protocol compatible services.\n\nThis crate was created for applications that need a robust, well-tested connection to PostgreSQL-compatible servers without the overhead of a full-featured ORM.\n\n## Features\n\n- **Simple API** - Straightforward query execution with minimal boilerplate\n- **Robust Error Handling** - Comprehensive error information with configurable verbosity\n- **Flexible Value Types** - Easy type conversion between PostgreSQL and Rust types\n- **SSL/TLS Support** - Secure connections with TLS and certificate validation\n- **Detailed Results** - Full access to all aspects of query results including notices\n- **libpq Foundation** - Built on the stable, production-tested libpq C library\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\npgwire-lite = \"0.1.0\"\n```\n\n## Quick Start\n\nThe following example connects to a local [**stackql**](https://github.com/stackql/stackql) server used to query cloud providers.\n\n```rust\nuse pgwire_lite::PgwireLite;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Connect to a StackQL server\n    let client = PgwireLite::new(\"localhost\", 5444, false, \"verbose\")?;\n    \n    // Pull a provider registry\n    client.query(\"REGISTRY PULL aws\")?;\n    \n    // Query AWS resources using SQL\n    let result = client.query(\n        \"SELECT region, name, instance_type \n         FROM aws.ec2.instances \n         WHERE region = 'us-east-1'\"\n    )?;\n    \n    // Process the results\n    println!(\"Found {} EC2 instances:\", result.row_count);\n    for row in \u0026result.rows {\n        println!(\n            \"Instance: {} ({}), Type: {}\", \n            row.get(\"name\").unwrap(),\n            row.get(\"region\").unwrap(),\n            row.get(\"instance_type\").unwrap()\n        );\n    }\n    \n    Ok(())\n}\n```\n## Error Handling\n\n**pgwire-lite** provides detailed error information and configurable verbosity:\n\n```rust\nuse pgwire_lite::PgwireLite;\n\nfn main() {\n    // Set verbosity to \"verbose\" for maximum error detail\n    let client = PgwireLite::new(\"localhost\", 5432, false, \"verbose\")\n        .expect(\"Failed to create client\");\n    \n    match client.query(\"SELECT * FROM nonexistent_table\") {\n        Ok(result) =\u003e {\n            println!(\"Query succeeded with {} rows\", result.row_count);\n        },\n        Err(e) =\u003e {\n            eprintln!(\"Query failed: {}\", e);\n            // Detailed error with context, hint, line numbers, etc.\n        }\n    }\n}\n```\n\n## TLS/SSL Support\n\nSecure your connections with TLS:\n\n```rust\nuse pgwire_lite::PgwireLite;\nuse std::env;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Set environment variables for TLS certificates\n    env::set_var(\"PGSSLMODE\", \"verify-full\");\n    env::set_var(\"PGSSLCERT\", \"/path/to/client-cert.pem\");\n    env::set_var(\"PGSSLKEY\", \"/path/to/client-key.pem\");\n    env::set_var(\"PGSSLROOTCERT\", \"/path/to/server-ca.pem\");\n    \n    // Create a client with TLS enabled\n    let client = PgwireLite::new(\"db.example.com\", 5432, true, \"default\")?;\n    \n    // Execute queries over a secure connection\n    let result = client.query(\"SELECT 1 as secure_conn_example\")?;\n    \n    Ok(())\n}\n```\n\n## Documentation\n\nFor more detailed usage examples and API documentation, please visit [docs.rs/pgwire-lite](https://docs.rs/pgwire-lite).\n\n## Building Locally\n\nThis project depends on `libpq` (PostgreSQL client library) which needs to be available at compile time.\n\n```bash\n# Linux (Ubuntu/Debian)\nsudo apt update\nsudo apt install -y libclang-dev libpq-dev pkg-config\n\n# macOS\nbrew update\nbrew install postgresql libpq\n# after installing with Homebrew on macOS, you may need to add libpq to your PATH:\necho 'export PATH=\"/usr/local/opt/libpq/bin:$PATH\"' \u003e\u003e ~/.zshrc\n# or for Intel Macs with Homebrew in the default location\n# for Apple Silicon Macs, use: echo 'export PATH=\"/opt/homebrew/opt/libpq/bin:$PATH\"' \u003e\u003e ~/.zshrc\n\n# Also set these environment variables for the compiler to find libpq\nexport LDFLAGS=\"-L/usr/local/opt/libpq/lib\"\nexport CPPFLAGS=\"-I/usr/local/opt/libpq/include\"\n```\n\n### Building the project\n\nTo build locally use:\n\n```bash\ncargo build            \t# Debug build\ncargo build --release  \t# Release build\n```\n\n### Testing the project\n\nThe tests provided can be performed with a [`stackql`](https://github.com/stackql/stackql) server.  \n\n\u003e Download [`stackql`](https://github.com/stackql/stackql) using:\n\u003e ```bash\n\u003e curl -L https://bit.ly/stackql-zip -O \u0026\u0026 unzip stackql-zip\n\u003e ```\n\n#### Without TLS\n\nTo test the library with a local server *without* tls, run the following:\n\n```bash\nsh start-server.sh\ncargo test --test integration\n# or with verbose output\nRUST_LOG=debug cargo test --test integration -- --nocapture\nsh stop-server.sh\n```\n\nTo run the examples with a local server *without* tls, use the following:\n\n```bash\nsh start-server.sh\ncargo run --example simple_query\n# or with verbose output\nRUST_LOG=debug cargo run --example simple_query\nsh stop-server.sh\n```\n#### With TLS\n\nTo test the library with a local server *with* tls, run the following:\n\n```bash\nsh start-secure-server.sh\ncargo test --test integration_mtls\n# or with verbose output\nRUST_LOG=debug cargo test --test integration_mtls -- --nocapture\nsh stop-server.sh\n```\nTo run the examples with a local server *with* tls, use the following:\n\n```bash\nsh start-secure-server.sh\ncargo run --example simple_query_with_mtls\n# or with verbose output\nRUST_LOG=debug cargo run --example simple_query_with_mtls\nsh stop-server.sh\n```\n\n### Documenting the project\n\nTo document the project locally, use:\n\n```bash\ncargo doc                # Generate documentation\ncargo doc --no-deps      # Generate docs excluding dependencies\n```\n\n### Other utilities\n\nOther useful `cargo` utilities include:\n\n```bash\ncargo fmt --all         # Formats all code according to Rust style guidelines\ncargo check             # Compiles without building an executable (pre build check)\ncargo clippy            # Suggests code improvements (linter)\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Acknowledgments\n\n- [libpq](https://www.postgresql.org/docs/current/libpq.html) C library\n- [stackql](https://github.com/stackql/stackql)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackql%2Fpgwire-lite-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackql%2Fpgwire-lite-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackql%2Fpgwire-lite-rs/lists"}