{"id":16485893,"url":"https://github.com/hanpama/pgmg","last_synced_at":"2025-10-15T15:55:13.646Z","repository":{"id":89902830,"uuid":"213293467","full_name":"hanpama/pgmg","owner":"hanpama","description":"PostgresQL model generator","archived":false,"fork":false,"pushed_at":"2020-02-17T15:40:10.000Z","size":351,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T00:12:11.269Z","etag":null,"topics":["code-generation","golang","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hanpama.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":"2019-10-07T04:17:33.000Z","updated_at":"2020-02-17T15:40:12.000Z","dependencies_parsed_at":"2023-04-16T17:15:18.611Z","dependency_job_id":null,"html_url":"https://github.com/hanpama/pgmg","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"da3c00728e7acd2130a26c3240c00d5f55355235"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hanpama/pgmg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanpama%2Fpgmg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanpama%2Fpgmg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanpama%2Fpgmg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanpama%2Fpgmg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanpama","download_url":"https://codeload.github.com/hanpama/pgmg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanpama%2Fpgmg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279090274,"owners_count":26101171,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"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":["code-generation","golang","postgresql","sql"],"created_at":"2024-10-11T13:27:39.320Z","updated_at":"2025-10-15T15:55:13.583Z","avatar_url":"https://github.com/hanpama.png","language":"Go","readme":"# PGMG\n\n\u003e This package is in development. The API is not stable and may change.\n\nPostgreSQL Model Generator\n\n```\nusage: pgmg -database \u003cconnection_string\u003e -schema \u003cschema_name\u003e -out \u003coutpath\u003e\n\nSee https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING\nfor more information about connection string parameters.\n\n1. generate a single file:\n\tgo run github.com/hanpama/pgmg \\\n\t\t-database 'user=postgres dbname=pgmg sslmode=disable' \\\n\t\t-schema wise \\\n\t\t-out example/schema.go # file\n\n2. generate each file per table:\n\tgo run github.com/hanpama/pgmg \\\n\t\t-database 'user=postgres dbname=pgmg sslmode=disable' \\\n\t\t-schema wise \\\n\t\t-out example/ # directory\n\n```\n\n## PGMG Generates\n\n* https://github.com/hanpama/pgmg/tree/master/example/tables/\n\n\n## How to use\n\nGenerated PGMG models have no concrete dependency on any SQL driver,\nbut depend on an interface `SQLHandle`.\n\n```go\ntype SQLHandle interface {\n\tQueryAndReceive(ctx context.Context, receiver func(int) []interface{}, sql string, args ...interface{}) (int, error)\n\tExecAndCount(ctx context.Context, sql string, args ...interface{}) (int64, error)\n}\n```\n\nSo your database connection should implement `SQLHandle` like the [test database](https://github.com/hanpama/pgmg/tree/master/example/testdb.go).\n\nThe `receiver func(int) []interface{}` parameter is a function returning pointers for `rows.Scan()`-like functions\nto scan data into.\n\n## Full Example\n\n* https://github.com/hanpama/pgmg/tree/master/example/tables/tables_test.go\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanpama%2Fpgmg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanpama%2Fpgmg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanpama%2Fpgmg/lists"}