{"id":19849638,"url":"https://github.com/ckpack/pg-helper","last_synced_at":"2026-05-14T19:34:59.292Z","repository":{"id":57102348,"uuid":"342130745","full_name":"ckpack/pg-helper","owner":"ckpack","description":"A lightweight node-postgres build query utils","archived":false,"fork":false,"pushed_at":"2021-04-07T03:49:16.000Z","size":278,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-14T13:03:34.627Z","etag":null,"topics":["node-postgres","pg","pg-helper","postgres","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ckpack.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}},"created_at":"2021-02-25T05:14:24.000Z","updated_at":"2021-04-09T05:25:18.000Z","dependencies_parsed_at":"2022-08-20T22:10:27.605Z","dependency_job_id":null,"html_url":"https://github.com/ckpack/pg-helper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckpack%2Fpg-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckpack%2Fpg-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckpack%2Fpg-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckpack%2Fpg-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckpack","download_url":"https://codeload.github.com/ckpack/pg-helper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241230052,"owners_count":19930911,"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":["node-postgres","pg","pg-helper","postgres","postgresql","sql"],"created_at":"2024-11-12T13:22:21.389Z","updated_at":"2026-05-14T19:34:59.244Z","avatar_url":"https://github.com/ckpack.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg-helper\n\nA lightweight [node-postgres](https://node-postgres.com/) build query utils.\n\nSince [node-postgres](https://node-postgres.com/) uses ordinal parameter query `($1, $2, etc)`, the variables need to have a clear order. Once too many parameters are used, it will be extremely troublesome. `pg-helper` allows you to build SQL easier, faster and safer.\n\n# Example\n\n```js\nconst {PgHelper} = require('@ckpack/pg-helper');  \nconst pgHelper = new PgHelper({\n    host,\n    user,\n    password,\n    database,\n    port: 5432,\n    max: 20,\n    idleTimeoutMillis: 30000,\n    connectionTimeoutMillis: 2000,\n  },{\n    logger: console,\n    returning: true,\n});\n\n// in node-postgres\n// pg.query(`SELECT * FROM ${tablename} WHERE field1 = $1 AND field2 = $2`, [field1, field2]);\n\n// in pg-helper \npgHelper.runSql(`SELECT * FROM ${tablename} WHERE field1 = {field1} AND field2 = {field2}`, {field1, field2});\n// Still supports the following way\npgHelper.runSql(`SELECT * FROM ${tablename} WHERE field1 = $1 AND field2 = $2`, [field1, field2])\n```\n\n# [Demos](__test__/)\n\n# [Documentation](https://ckpack.github.io/pg-helper/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckpack%2Fpg-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckpack%2Fpg-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckpack%2Fpg-helper/lists"}