{"id":28518673,"url":"https://github.com/michaellzc/egg-pg","last_synced_at":"2026-04-29T01:01:27.432Z","repository":{"id":57112416,"uuid":"119917791","full_name":"michaellzc/egg-pg","owner":"michaellzc","description":"PostgreSQL Plugin which supports pooling for egg.","archived":false,"fork":false,"pushed_at":"2020-06-01T20:28:08.000Z","size":689,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T18:58:52.301Z","etag":null,"topics":["egg-pg","egg-plugin","eggjs","node-postgres","pg","postgres","postgresql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/michaellzc.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}},"created_at":"2018-02-02T01:59:13.000Z","updated_at":"2023-09-19T03:18:57.000Z","dependencies_parsed_at":"2022-08-21T10:00:12.504Z","dependency_job_id":null,"html_url":"https://github.com/michaellzc/egg-pg","commit_stats":null,"previous_names":["exiasr/egg-pg"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/michaellzc/egg-pg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellzc%2Fegg-pg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellzc%2Fegg-pg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellzc%2Fegg-pg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellzc%2Fegg-pg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaellzc","download_url":"https://codeload.github.com/michaellzc/egg-pg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellzc%2Fegg-pg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: 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":["egg-pg","egg-plugin","eggjs","node-postgres","pg","postgres","postgresql"],"created_at":"2025-06-09T05:37:59.872Z","updated_at":"2026-04-29T01:01:27.409Z","avatar_url":"https://github.com/michaellzc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egg-pg\n\n[![dependencies Status](https://david-dm.org/ExiaSR/egg-pg/status.svg?style=flat-square)](https://david-dm.org/ExiaSR/egg-pg)\n\nPostgreSQL plugin which supports pooling for egg.\n\nThis plugin exposes the [Pool](https://node-postgres.com/api/pool) object from [node-postgres](https://node-postgres.com) at `app.pg`.\n\nLatest version of [node-postgres](https://node-postgres.com): **7.10.0**\n\n## Install\n`npm i @exiasr/egg-pg`\n\n`yarn add @exiasr/egg-pg`\n\n## Configuration\n### Enable plugin\n```js\n// {app_root}/config/plugin.js\nexports.pg = {\n  enable: true,\n  package: '@exiasr/egg-pg',\n};\n```\n### Sample\n\n```js\n// {app_root}/config/config.default.js\nexports.pg = {\n  user: 'root',\n  host: 'localhost',\n  database: 'compose',\n  password: 'supersecure',\n  port: '27017',\n};\n```\n### Single database instance\n```js\n// {app_root}/config/config.default.js\nexports.pg = {\n  connectionString: 'postgres://\u003cuser\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdatabase\u003e',\n}\n```\n### Multiple database instance\n```js\n// {app_root}/config/config.default.js\nexports.pg = {\n  clients: {\n    client1: {\n      connectionString: 'postgres://root:supersecure@localhost:27017/compose',\n    },\n    client2: {\n      connectionString: 'postgres://root:supersecure@localhost:27018/compose',\n    },\n  },\n};\n```\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n## Usage\n### Single database instance\n```js\nconst { app } = this;\nconst pool = app.pg;\nconst { rows } = await pool.query('SELECT NOW()');\n```\n\n### Multiple database instance\n```js\nconst { app } = this;\nconst pool = app.pg.get('\u003cclient_name\u003e');\nconst { rows } = await pool.query('SELECT NOW()');\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaellzc%2Fegg-pg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaellzc%2Fegg-pg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaellzc%2Fegg-pg/lists"}