{"id":44151316,"url":"https://github.com/adrianbrad/psqldocker","last_synced_at":"2026-02-09T03:34:16.992Z","repository":{"id":52276122,"uuid":"480491713","full_name":"adrianbrad/psqldocker","owner":"adrianbrad","description":"🚢  Go package providing lifecycle management for PostgreSQL Docker instances.","archived":false,"fork":false,"pushed_at":"2024-05-27T06:04:13.000Z","size":182,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-19T16:33:18.393Z","etag":null,"topics":["docker","go","postgresql"],"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/adrianbrad.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-04-11T17:55:13.000Z","updated_at":"2024-05-05T08:32:12.000Z","dependencies_parsed_at":"2024-01-04T17:30:36.046Z","dependency_job_id":"44aee9ba-e795-4b26-8dfa-a9aacfd994a8","html_url":"https://github.com/adrianbrad/psqldocker","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/adrianbrad/psqldocker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbrad%2Fpsqldocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbrad%2Fpsqldocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbrad%2Fpsqldocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbrad%2Fpsqldocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianbrad","download_url":"https://codeload.github.com/adrianbrad/psqldocker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianbrad%2Fpsqldocker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29255602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T03:07:45.136Z","status":"ssl_error","status_checked_at":"2026-02-09T03:07:24.123Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["docker","go","postgresql"],"created_at":"2026-02-09T03:34:16.353Z","updated_at":"2026-02-09T03:34:16.985Z","avatar_url":"https://github.com/adrianbrad.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" width=\"300\" src=\"https://github.com/adrianbrad/psqldocker/blob/image-data/psql_docker.png?raw=true\" alt=\"adrianbrad psqldocker\"\u003e\n\n# 🚢 psqldocker ![GitHub release](https://img.shields.io/github/v/release/adrianbrad/psqldocker)\n\npowered by [`ory/dockertest`](https://github.com/ory/dockertest).\n\n[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/adrianbrad/psqldocker)](https://github.com/adrianbrad/psqldocker)\n[![GoDoc reference example](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/adrianbrad/psqldocker)\n\n[![CodeFactor](https://www.codefactor.io/repository/github/adrianbrad/psqldocker/badge)](https://www.codefactor.io/repository/github/adrianbrad/psqldocker)\n[![Go Report Card](https://goreportcard.com/badge/github.com/adrianbrad/psqldocker)](https://goreportcard.com/report/github.com/adrianbrad/psqldocker)\n[![codecov](https://codecov.io/gh/adrianbrad/psqldocker/branch/main/graph/badge.svg)](https://codecov.io/gh/adrianbrad/psqldocker)\n\n[![lint-test](https://github.com/adrianbrad/psqldocker/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/adrianbrad/psqldocker/actions?query=workflow%3Alint-test)\n[![grype](https://github.com/adrianbrad/psqldocker/actions/workflows/grype.yaml/badge.svg)](https://github.com/adrianbrad/psqldocker/actions?query=workflow%3Agrype)\n[![codeql](https://github.com/adrianbrad/psqldocker/workflows/CodeQL/badge.svg)](https://github.com/adrianbrad/psqldocker/actions?query=workflow%3ACodeQL)\n[![gitleaks](https://github.com/adrianbrad/psqldocker/workflows/gitleaks/badge.svg)](https://github.com/adrianbrad/psqldocker/actions?query=workflow%3Agitleaks)\n\n---\nGo package providing lifecycle management for PostgreSQL Docker instances.\n\n[Here](https://adrianbrad.medium.com/parallel-postgresql-tests-go-docker-6fb51c016796) is an article expanding on the usage of this package.\n\nLeverage Docker to run unit and integration tests against a real PostgreSQL database.\n\n### Usage\n#### Recommended: In a TestXxx function\n\n```go\npackage foo_test\n\nimport (\n\t\"testing\"\n\n\t\"github.com/adrianbrad/psqldocker\"\n)\n\nfunc TestXxx(t *testing.T) {\n    const schema = \"CREATE TABLE users(user_id UUID PRIMARY KEY);\"\n\t\n    c, err := psqldocker.NewContainer(\n        \"user\",\n        \"password\",\n        \"dbName\",\n        psqldocker.WithContainerName(\"test\"), \n        // initialize with a schema\n        psqldocker.WithSql(schema),\n        // you can add other options here\n    )\n    if err != nil {\n        t.Fatalf(\"cannot start new psql container: %s\\n\", err)\n    }\n\t\n    t.Cleanup(func() {\n        err = c.Close()\n        if err != nil {\n            t.Logf(\"err while closing conainter: %w\", err)\n        }\n    })\n\t\n    t.Run(\"Subtest\", func(t *testing.T) {\n        // execute your test logic here \n    })\n}\n```\n---\n#### In a TestMain function\n\n```go\npackage foo_test\n\nimport (\n\t\"log\"\n\t\"testing\"\n\n\t\"github.com/adrianbrad/psqldocker\"\n)\n\nfunc TestMain(m *testing.M) {\n    const schema = \"CREATE TABLE users(user_id UUID PRIMARY KEY);\"\n\n    c, err := psqldocker.NewContainer(\n        \"user\",\n        \"password\",\n        \"dbName\",\n        psqldocker.WithContainerName(\"test\"), \n        // initialize with a schema\n        psqldocker.WithSql(schema),\n        // you can add other options here\n    )\n    if err != nil {\n        log.Fatalf(\"cannot start new psql container: %s\\n\", err)\n    }\n\t\n    defer func() {\n        err = c.Close()\n        if err != nil {\n            log.Printf(\"err while closing conainter: %w\", err)\n        }\n    }() \n\t\n    m.Run()\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbrad%2Fpsqldocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianbrad%2Fpsqldocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbrad%2Fpsqldocker/lists"}