{"id":25271652,"url":"https://github.com/viniciuscestarii/postgres-protocol-go","last_synced_at":"2026-05-05T07:31:10.518Z","repository":{"id":275158517,"uuid":"924662546","full_name":"ViniciusCestarii/postgres-protocol-go","owner":"ViniciusCestarii","description":"🐘 PostgreSQL driver in Go using only the standard library","archived":false,"fork":false,"pushed_at":"2025-04-30T12:20:39.000Z","size":79,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T13:50:35.466Z","etag":null,"topics":["postgresql","postgresql-driver","postgresql-protocol","scram-sha-256"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ViniciusCestarii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-01-30T12:29:13.000Z","updated_at":"2025-04-30T12:20:43.000Z","dependencies_parsed_at":"2025-04-30T13:49:47.542Z","dependency_job_id":"be20191a-3611-465f-8745-47d2485c373f","html_url":"https://github.com/ViniciusCestarii/postgres-protocol-go","commit_stats":null,"previous_names":["viniciuscestarii/postgres-protocol-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ViniciusCestarii/postgres-protocol-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ViniciusCestarii%2Fpostgres-protocol-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ViniciusCestarii%2Fpostgres-protocol-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ViniciusCestarii%2Fpostgres-protocol-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ViniciusCestarii%2Fpostgres-protocol-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ViniciusCestarii","download_url":"https://codeload.github.com/ViniciusCestarii/postgres-protocol-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ViniciusCestarii%2Fpostgres-protocol-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32640533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["postgresql","postgresql-driver","postgresql-protocol","scram-sha-256"],"created_at":"2025-02-12T12:34:59.623Z","updated_at":"2026-05-05T07:31:10.513Z","avatar_url":"https://github.com/ViniciusCestarii.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postgres Protocol Go\n\nThis project implements the PostgreSQL wire protocol in Go using only the standard library.\n\n## Usage\n\n```go\nfunc main() {\n\tconnStr := \"postgres://postgres:123456@localhost:5432/postgres\"\n\n\tdriveConfig := models.DriveConfig{Verbose: true,}\n\n\tpgConnection, err := protocol.NewPgConnection(connStr, driveConfig)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tuserToFind := \"postgres\"\n\n\tres, err := pgConnection.Query(\"SELECT * FROM pg_user WHERE usename = $1;\", userToFind)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpgConnection.Close()\n\t\treturn\n\t}\n\n\tfmt.Println(\"Postgres user: \", res.Rows)\n\n\tpgConnection.Close()\n}\n```\n\n## Features\n\n- Flexible Connection Handling\n\t- Supports both URL-style connection strings (postgres://user:pass@host:port/db)\n\t- Supports key-value connection strings (`host=localhost port=5432`)\n- SSL/TLS Support\n\t- Automatic SSL/TLS negotiation when `sslmode=require`\n\t- Secure encrypted connections\n- Query Interface\n\t- Simple query protocol support\n\t- Extended query protocol with parameter binding\n\t- Support for parameterized queries using $1, $2 etc.\n- Connection Configuration\n\t- Configurable verbose mode for debugging\n\t- Custom drive configuration options via models.DriveConfig\n- Authentication\n\t- SCRAM-SHA-256\n  \t- md5\n  \t- clear text\n- Clean Resource Management\n\t- Proper connection termination\n\n## Running the Client Implementation example\n\n1. Clone the repository:\n\t```bash\n\tgit clone https://github.com/ViniciusCestarii/postgres-protocol-go.git\n\t```\n\n2. Create environment file:\n\t```bash\n\tcp .env.example .env\n\t```\n\n3. Set the environment variables in the `.env` file.\n\n4. Run the client implementation:\n\t```bash\n\tgo run cmd/client.go\n\t```\n\n## Folder Structure\n\n```bash\npostgres-protocol-go/\n│── cmd/\n│   ├── client.go        # Client implementation example using this driver\n│── internal/\n│   ├── pool/            # Buff writer\n│   ├── protocol/        # PostgreSQL wire protocol handling\n│── pkg/\n│   ├── utils/           # Shared utilities (logging, errors, helpers)\n│   ├── models/          # Data structures for queries, results, etc.\n│── tests/               # Integration and unit tests\n│── go.mod               # Go module file\n│── README.md            # Project documentation\n```\n\n## Testing\n\nTo run the tests, use the following commands:\n\n```bash\ngo test ./tests/...\n```\n\n## Resources\n\n[Official Protocol Documentation](https://www.postgresql.org/docs/16/protocol.html)\n\n[Message Formats](https://www.postgresql.org/docs/16/protocol-message-formats.html)\n\n[pbkdf2 go implementation](https://cs.opensource.google/go/x/crypto/+/refs/tags/v0.32.0:pbkdf2/pbkdf2.go)\n\n[gp-pg](https://github.com/go-pg/pg)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviniciuscestarii%2Fpostgres-protocol-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviniciuscestarii%2Fpostgres-protocol-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviniciuscestarii%2Fpostgres-protocol-go/lists"}