{"id":17919356,"url":"https://github.com/zombiezen/postgrestest","last_synced_at":"2025-05-09T00:09:40.533Z","repository":{"id":54840023,"uuid":"286083863","full_name":"zombiezen/postgrestest","owner":"zombiezen","description":"A Go test harness that starts an ephemeral PostgreSQL server","archived":false,"fork":false,"pushed_at":"2024-12-11T21:56:14.000Z","size":43,"stargazers_count":59,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-09T00:09:31.360Z","etag":null,"topics":["golang","postgres","postgresql","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zombiezen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"zombiezen"}},"created_at":"2020-08-08T16:58:27.000Z","updated_at":"2025-05-02T09:13:54.000Z","dependencies_parsed_at":"2024-12-11T22:37:02.354Z","dependency_job_id":null,"html_url":"https://github.com/zombiezen/postgrestest","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"7e4585ff315f227af5362fbf46ff3a5a20f3aa02"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zombiezen%2Fpostgrestest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zombiezen%2Fpostgrestest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zombiezen%2Fpostgrestest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zombiezen%2Fpostgrestest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zombiezen","download_url":"https://codeload.github.com/zombiezen/postgrestest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166521,"owners_count":21864482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","postgres","postgresql","testing"],"created_at":"2024-10-28T20:16:16.660Z","updated_at":"2025-05-09T00:09:40.504Z","avatar_url":"https://github.com/zombiezen.png","language":"Go","funding_links":["https://github.com/sponsors/zombiezen"],"categories":[],"sub_categories":[],"readme":"# `zombiezen.com/go/postgrestest`\n\n[![Reference](https://pkg.go.dev/badge/zombiezen.com/go/postgrestest?tab=doc)](https://pkg.go.dev/zombiezen.com/go/postgrestest?tab=doc)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n\nPackage `postgrestest` provides a test harness that starts an ephemeral\n[PostgreSQL][] server. It is tested on macOS, Linux, and Windows. It can cut\ndown the overhead of PostgreSQL in tests up to 90% compared to spinning up a\n`postgres` Docker container: starting a server with this package takes\nroughly 650 milliseconds and creating a database takes roughly 20 milliseconds.\n\n[PostgreSQL]: https://www.postgresql.org/\n\n## Example\n\n```go\nfunc TestApp(t *testing.T) {\n\t// Start up the PostgreSQL server. This can take a few seconds, so better to\n\t// do it once per test run.\n\tctx := context.Background()\n\tsrv, err := postgrestest.Start(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Cleanup(srv.Cleanup)\n\n\t// Each of your subtests can have their own database:\n\tt.Run(\"Test1\", func(t *testing.T) {\n\t\tdb, err := srv.NewDatabase(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif _, err := db.Exec(`CREATE TABLE foo (id SERIAL PRIMARY KEY);`); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t// ...\n\t})\n\n\tt.Run(\"Test2\", func(t *testing.T) {\n\t\tdb, err := srv.NewDatabase(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif _, err := db.Exec(`CREATE TABLE foo (id SERIAL PRIMARY KEY);`); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t// ...\n\t})\n}\n```\n\n## Installation\n\nPostgreSQL must be installed locally for this package to work. See the\n[PostgreSQL Downloads page][] for instructions on how to obtain PostgreSQL for\nyour operating system.\n\nTo install the package:\n\n```\ngo get zombiezen.com/go/postgrestest\n```\n\n[PostgreSQL Downloads page]: https://www.postgresql.org/download/\n\n## License\n\n[Apache 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzombiezen%2Fpostgrestest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzombiezen%2Fpostgrestest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzombiezen%2Fpostgrestest/lists"}