{"id":16756789,"url":"https://github.com/charmander/pg-auto","last_synced_at":"2026-04-10T21:14:39.858Z","repository":{"id":57322566,"uuid":"109756196","full_name":"charmander/pg-auto","owner":"charmander","description":"A wrapper around pg adding type safety to queries","archived":false,"fork":false,"pushed_at":"2018-05-21T02:43:11.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-27T21:18:07.242Z","etag":null,"topics":["nodejs","postgresql"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/pg-auto","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charmander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-06T22:13:12.000Z","updated_at":"2019-12-05T23:09:21.000Z","dependencies_parsed_at":"2022-08-26T01:11:25.368Z","dependency_job_id":null,"html_url":"https://github.com/charmander/pg-auto","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/charmander/pg-auto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Fpg-auto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Fpg-auto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Fpg-auto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Fpg-auto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charmander","download_url":"https://codeload.github.com/charmander/pg-auto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Fpg-auto/sbom","scorecard":{"id":274569,"data":{"date":"2025-08-11","repo":{"name":"github.com/charmander/pg-auto","commit":"eb91aed645e19073fc5428bd67d5c57393b543c4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T14:08:17.718Z","repository_id":57322566,"created_at":"2025-08-17T14:08:17.718Z","updated_at":"2025-08-17T14:08:17.718Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31659257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"ssl_error","status_checked_at":"2026-04-10T17:19:13.364Z","response_time":98,"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":["nodejs","postgresql"],"created_at":"2024-10-13T03:42:05.439Z","updated_at":"2026-04-10T21:14:39.816Z","avatar_url":"https://github.com/charmander.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status][ci image]][ci]\n\npg-auto is a wrapper around [pg][] that enforces type safety with queries and defaults to returning [Bluebird][bluebird] promises.\n\n\n## Installation\n\n```shellsession\n$ npm install pg-auto\n```\n\n\n## Usage\n\nImport pg-auto’s main tools:\n\n```js\nconst {Pool, sql} = require('pg-auto');\n```\n\nCreate a connection pool (the options are the same as pg’s [client][pg-client-options] and [pool][pg-pool-options] options):\n\n```js\nconst db = new Pool({\n    host: '/var/run/postgresql',\n    database: 'example',\n});\n```\n\nAdd an error listener to avoid exiting when a pooled client not currently in use encounters an error:\n\n```js\ndb.on('error', error =\u003e {\n    console.error('Idle client error:', error);\n});\n```\n\nCreate queries with the `sql` template literal tag and run them through the pool:\n\n```js\nconst language = 'en';\nconst result = await db.query(sql`SELECT greeting FROM greetings WHERE language = ${language}`);\nconsole.log(result.rows[0].greeting);  // Hello, world!\n```\n\n\n## API\n\n### \u003ccode\u003esql\\`…\\`\u003c/code\u003e\n\nA template literal tag for SQL. Converts interpolated values to query parameters.\n\n### ``sql`…`.concat(sql`…`)``\n\nReturns the concatenation of two pieces of SQL. For more complex dynamic queries, consider using a query builder (like [Knex][knex] or [node-sql][]) instead.\n\n```js\nlet query = sql`SELECT greeting FROM greetings`;\n\nif (searchPattern) {\n    query = query.concat(sql` WHERE language ILIKE '%' || ${searchPattern} || '%'`);\n}\n\nawait db.query(query);\n```\n\n### `new Pool([options])`\n\nConstructs a connection pool. The options are the same as pg’s [client][pg-client-options] and [pool][pg-pool-options] options, and the pool emits the same events as the pg pool.\n\n### `Pool#query(query)`\n\nRuns a query using a client from the pool, returning a Bluebird promise that will resolve to a [pg result][pg-result].\n\n### `Pool#transaction(action, [options])`\n\nRuns the function `action` in a transaction, passing the client in which the transaction is active as an argument to `action`. `action` should return a promise. The transaction will be committed if the returned promise resolves, and rolled back if it rejects.\n\nThe available options, which reflect [the options to `BEGIN`][begin-options], are:\n\n- `isolationLevel`: Controls the transaction’s isolation level. One of `'read committed'`, `'repeatable read'`, or `'serializable'`.\n- `readOnly`: Whether the transaction should be read-only.\n- `deferrable`: Whether the transaction should be deferrable.\n\n```js\nawait db.transaction(async client =\u003e {\n    await client.query(sql`INSERT INTO a VALUES ('a')`);\n    await client.query(sql`INSERT INTO b VALUES ('b')`);\n});\n```\n\n### `Pool#acquire()`\n\nFor other, non-[transaction](#pool-transaction-action-options) cases when multiple queries have to be run in the same client. Returns a [Bluebird-managed][bluebird-resources] client object that provides a `query()` and `transaction()` respectively equivalent to [`Pool#query`](#pool-query-query) and [`Pool#transaction`](#pool-transaction-action-options), and emits the same events as a pg client.\n\n### `Pool#end()`\n\nCloses pool connections and invalidates the pool, like [`pg.Pool#end()`][pg-pool-end].\n\n\n## FAQ\n\n### How do I use a variable number of values with `IN`?\n\nUse an array parameter with [the `= ANY` operator][any-array-operator] instead:\n\n```js\nconst names = ['a', 'b', 'c'];\n\ndb.query(sql`SELECT id FROM tags WHERE name = ANY (${names})`)\n```\n\n### Why isn’t my server exiting?\n\npg-auto uses a connection pool, which keeps connections alive for a while to avoid the overhead of creating new connections. Use [`db.end()`](#pool-end) to close idle connections and allow Node to exit.\n\n\n  [any-array-operator]: https://www.postgresql.org/docs/10/static/functions-comparisons.html#idm46046882500112\n  [begin-options]: https://www.postgresql.org/docs/10/static/sql-begin.html\n  [bluebird]: https://github.com/petkaantonov/bluebird\n  [bluebird-resources]: http://bluebirdjs.com/docs/api/resource-management.html\n  [knex]: http://knexjs.org/\n  [node-sql]: https://github.com/brianc/node-sql\n  [pg]: https://github.com/brianc/node-postgres\n  [pg-client-options]: https://node-postgres.com/api/client#new-client-config-object-\n  [pg-pool-end]: https://node-postgres.com/api/pool#pool-end\n  [pg-pool-options]: https://node-postgres.com/api/pool#new-pool-config-object-\n  [pg-result]: https://node-postgres.com/api/result\n\n  [ci]: https://travis-ci.org/charmander/pg-auto\n  [ci image]: https://api.travis-ci.org/charmander/pg-auto.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmander%2Fpg-auto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharmander%2Fpg-auto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmander%2Fpg-auto/lists"}