{"id":24702706,"url":"https://github.com/habx/pg-commands","last_synced_at":"2025-09-08T12:34:50.702Z","repository":{"id":45050060,"uuid":"290766920","full_name":"habx/pg-commands","owner":"habx","description":"Golang library: Postgres commands (pg_restore, pg_dumpg)","archived":false,"fork":false,"pushed_at":"2023-05-02T13:35:05.000Z","size":111,"stargazers_count":48,"open_issues_count":4,"forks_count":15,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-06-18T17:07:41.253Z","etag":null,"topics":["golang","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/habx.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}},"created_at":"2020-08-27T12:16:41.000Z","updated_at":"2024-06-03T21:14:12.000Z","dependencies_parsed_at":"2024-06-18T16:55:04.878Z","dependency_job_id":"b8391a02-6822-4e6b-b491-25e293dc2547","html_url":"https://github.com/habx/pg-commands","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habx%2Fpg-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habx%2Fpg-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habx%2Fpg-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/habx%2Fpg-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/habx","download_url":"https://codeload.github.com/habx/pg-commands/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235807657,"owners_count":19047986,"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","postgresql"],"created_at":"2025-01-27T05:51:10.076Z","updated_at":"2025-01-27T05:51:10.713Z","avatar_url":"https://github.com/habx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg-commands\n\n[![codecov](https://codecov.io/gh/habx/pg-commands/branch/dev/graph/badge.svg?token=YTMXFOJDCZ)](https://codecov.io/gh/habx/pg-commands)\n[![Release](https://img.shields.io/github/v/release/habx/pg-commands)](https://github.com/habx/pg-commands/releases/latest)\n[![Go version](https://img.shields.io/github/go-mod/go-version/habx/pg-commands/dev)](https://golang.org/doc/devel/release.html)\n[![CircleCI](https://img.shields.io/circleci/build/github/habx/pg-commands/dev)](https://app.circleci.com/pipelines/github/habx/pg-commands)\n[![License](https://img.shields.io/github/license/habx/pg-commands)](/LICENSE)\n[![Go Reference](https://pkg.go.dev/badge/github.com/habx/pg-commands.svg)](https://pkg.go.dev/github.com/habx/pg-commands)\n\n## install\n\n```bash\ngo get -t github.com/habx/pg-commands\n```\n\n## Example\n\n### Code\n\n\n```go\ndump, _ := pg.NewDump(\u0026pg.Postgres{\n    Host:     \"localhost\",\n    Port:     5432,\n    DB:       \"dev_example\",\n    Username: \"example\",\n    Password: \"example\",\n})\ndumpExec := dump.Exec(pg.ExecOptions{StreamPrint: false})\nif dumpExec.Error != nil {\n    fmt.Println(dumpExec.Error.Err)\n    fmt.Println(dumpExec.Output)\n\n} else {\n    fmt.Println(\"Dump success\")\n    fmt.Println(dumpExec.Output)\n}\n\nrestore, _ := pg.NewRestore(\u0026pg.Postgres{\n    Host:     \"localhost\",\n    Port:     5432,\n    DB:       \"dev_example\",\n    Username: \"example\",\n    Password: \"example\",\n})\nrestoreExec := restore.Exec(dumpExec.File, pg.ExecOptions{StreamPrint: false})\nif restoreExec.Error != nil {\n    fmt.Println(restoreExec.Error.Err)\n    fmt.Println(restoreExec.Output)\n\n} else {\n    fmt.Println(\"Restore success\")\n    fmt.Println(restoreExec.Output)\n\n}\n```\n\n### Lab\n\n```\n$ cd examples\n$ docker-compose up -d\n$ cd ..\n$ POSTGRES_USER=example POSTGRES_PASSWORD=example POSTGRES_DB=postgres  go run tests/fixtures/scripts/init-database/init-database.go\n\n$ go run main.go\nDump success\n\nRestore success\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabx%2Fpg-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhabx%2Fpg-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhabx%2Fpg-commands/lists"}