{"id":13451931,"url":"https://github.com/vitaly-t/pg-promise","last_synced_at":"2026-03-06T02:59:24.200Z","repository":{"id":28133216,"uuid":"31632536","full_name":"vitaly-t/pg-promise","owner":"vitaly-t","description":"PostgreSQL interface for Node.js","archived":false,"fork":false,"pushed_at":"2026-02-11T20:18:39.000Z","size":8449,"stargazers_count":3550,"open_issues_count":0,"forks_count":221,"subscribers_count":43,"default_branch":"master","last_synced_at":"2026-02-12T03:55:57.138Z","etag":null,"topics":["javascript","nodejs","postgresql","promise-library","promises","transaction","typescript"],"latest_commit_sha":null,"homepage":"https://vitaly-t.github.io/pg-promise","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/vitaly-t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-03-04T02:00:34.000Z","updated_at":"2026-02-11T20:18:29.000Z","dependencies_parsed_at":"2023-02-15T15:01:44.506Z","dependency_job_id":"14c950e9-c4d6-4e65-8f46-3ef7a4740b79","html_url":"https://github.com/vitaly-t/pg-promise","commit_stats":{"total_commits":2478,"total_committers":39,"mean_commits":63.53846153846154,"dds":"0.10411622276029053","last_synced_commit":"710e079d27f8d77831f41539336531ca6336c63f"},"previous_names":[],"tags_count":641,"template":false,"template_full_name":null,"purl":"pkg:github/vitaly-t/pg-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaly-t%2Fpg-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaly-t%2Fpg-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaly-t%2Fpg-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaly-t%2Fpg-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitaly-t","download_url":"https://codeload.github.com/vitaly-t/pg-promise/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaly-t%2Fpg-promise/sbom","scorecard":{"id":924043,"data":{"date":"2025-08-11","repo":{"name":"github.com/vitaly-t/pg-promise","commit":"563b7c2162ba3ce3d46f7f85ee86758af18691f2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":0,"reason":"Found 2/30 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":"Maintained","score":7,"reason":"6 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"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":"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/vitaly-t/pg-promise/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/vitaly-t/pg-promise/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/vitaly-t/pg-promise/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/vitaly-t/pg-promise/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/vitaly-t/pg-promise/ci.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:22","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:74","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT 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":"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":"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"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-25T08:50:42.953Z","repository_id":28133216,"created_at":"2025-08-25T08:50:42.953Z","updated_at":"2025-08-25T08:50:42.953Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30159998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"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":["javascript","nodejs","postgresql","promise-library","promises","transaction","typescript"],"created_at":"2024-07-31T07:01:07.296Z","updated_at":"2026-03-06T02:59:24.190Z","avatar_url":"https://github.com/vitaly-t.png","language":"JavaScript","funding_links":[],"categories":["Packages","JavaScript","Repository","包","Database","目录","\u003ca id=\"1d9dec1320a5d774dc8e0e7604edfcd3\"\u003e\u003c/a\u003e工具-新添加的","Compiled list"],"sub_categories":["Database","数据库","Database ODM / ORM","\u003ca id=\"8f1b9c5c2737493524809684b934d49a\"\u003e\u003c/a\u003e文章\u0026\u0026视频","plv8:"],"readme":"pg-promise\n==========\n\n[![Build Status](https://github.com/vitaly-t/pg-promise/actions/workflows/ci.yml/badge.svg)](https://github.com/vitaly-t/pg-promise/actions/workflows/ci.yml)\n[![Node Version](https://img.shields.io/badge/nodejs-16%20--%2024-green.svg?logo=node.js\u0026style=flat)](https://nodejs.org)\n[![Postgres Version](https://img.shields.io/badge/postgresql-10%20--%2018-green.svg?logo=postgresql\u0026style=flat)](https://www.postgresql.org)\n\n---\n\nPostgreSQL interface for Node.js\n\n---\n\n* [About](#about)\n* [Documentation](#documentation)\n* [Contributing](#contributing) \n* [Usage]\n  - [Methods](#methods)\n  - [Query Formatting](#query-formatting)\n    - [Index Variables]  \n    - [Named Parameters]\n      - [Nested Named Parameters]\n  - [Formatting Filters](#formatting-filters)          \n    - [SQL Names]  \n      - [Alias Filter]    \n    - [Raw Text]  \n    - [Open Values]\n    - [JSON Filter]\n    - [CSV Filter]    \n  - [Custom Type Formatting]\n    - [Explicit CTF]\n    - [Symbolic CTF]    \n  - [Query Files]    \n  - [Tasks]    \n    - [Conditional Tasks]  \n  - [Transactions]    \n    - [Nested Transactions]    \n      - [Limitations]   \n    - [Configurable Transactions]\n    - [Conditional Transactions]    \n  - [Library de-initialization]\n\n---\n\n# About\n\nBuilt on top of [node-postgres], this library adds the following:\n\n* Automatic connections\n* Automatic transactions\n* Powerful query-formatting engine + query generation\n* Declarative approach to handling query results\n* Global events reporting for central handling\n* Extensive support for external SQL files\n\nAt its inception in 2015, this library was only adding promises to the base driver, hence the name `pg-promise`.\nAnd while the original name was kept, the library's functionality was vastly extended, with promises now being\nonly its tiny part.\n\n# Documentation\n\nChapter [Usage] below explains the basics you need to know, while the [Official Documentation]\ngets you started, and provides links to all other resources.\n\n# Contributing\n\nPlease read the [Contribution Notes] before opening any new issue or PR.\n\n# Usage\n\nOnce you have created a [Database] object, according to the steps in the [Official Documentation],\nyou get access to the methods documented below. \n\n## Methods \n\nAll query methods of the library are based off generic method [query].\n\nYou should normally use only the derived, result-specific methods for executing queries, all of which are named according\nto how many rows of data the query is expected to return, so for each query you should pick the right method:\n[none], [one], [oneOrNone], [many], [manyOrNone] = [any]. Do not confuse the method name for the number of rows\nto be affected by the query, which is completely irrelevant.\n\nBy relying on the result-specific methods you protect your code from an unexpected number of data rows,\nto be automatically rejected (treated as errors).  \n\nThere are also a few specific methods that you will often need:\n\n* [result], [multi], [multiResult] - for verbose and/or multi-query results;\n* [map], [each] - for simpler/inline result pre-processing/re-mapping;\n* [func], [proc] - to simplify execution of SQL functions/procedures;\n* [stream] - to access rows from a query via a read stream;\n* [connect], [task], [tx] + [txIf] - for shared connections + automatic transactions, each exposing a connected protocol\n  that has additional methods [batch], [page] and [sequence].\n\nThe protocol is fully customizable / extendable via event [extend].\n\n**IMPORTANT:**\n\nThe most important methods to understand from start are [task] and [tx]/[txIf] (see [Tasks] and [Transactions]).\nAs documented for method [query], it acquires and releases the connection, which makes it a poor choice for executing\nmultiple queries at once. For this reason, [Chaining Queries] is a must-read, to avoid writing the code that misuses connections.\n\n[Learn by Example] is a beginner's tutorial based on examples.\n\n## Query Formatting\n\nThis library comes with embedded query-formatting engine that offers high-performance value escaping,\nflexibility and extensibility. It is used by default with all query methods, unless you opt out of it entirely\nvia option `pgFormatting` within [Initialization Options].  \n\nAll formatting methods used internally are available from the [formatting] namespace, so they can also be used\ndirectly when needed. The main method there is [format], used by every query method to format the query. \n\nThe formatting syntax for variables is decided from the type of `values` passed in:\n\n* [Index Variables] when `values` is an array or a single basic type;\n* [Named Parameters] when `values` is an object (other than `Array` or `null`).\n\n**ATTENTION:** Never use ES6 template strings or manual concatenation to generate queries, as both\ncan easily result in broken queries! Only this library's formatting engine knows how to properly escape\nvariable values for PostgreSQL.\n\n### Index Variables\n\nThe simplest (classic) formatting uses `$1, $2, ...` syntax to inject values into the query string,\nbased on their index (from `$1` to `$100000`) from the array of values: \n\n```js\nawait db.any('SELECT * FROM product WHERE price BETWEEN $1 AND $2', [1, 10])\n```\n\nThe formatting engine also supports single-value parametrization for queries that use only variable `$1`: \n\n```js\nawait db.any('SELECT * FROM users WHERE name = $1', 'John')\n```\n\nThis however works only for types `number`, `bigint`, `string`, `boolean`, `Date` and `null`, because types like `Array`\nand `Object` change the way parameters are interpreted. That's why passing in index variables within an array\nis advised as safer, to avoid ambiguities.\n\n### Named Parameters\n\nWhen a query method is parameterized with `values` as an object, the formatting engine expects the query to use\nthe Named Parameter syntax `$*propName*`, with `*` being any of the following open-close pairs: `{}`, `()`, `\u003c\u003e`, `[]`, `//`.\n\n```js\n// We can use every supported variable syntax at the same time, if needed:\nawait db.none('INSERT INTO users(first_name, last_name, age) VALUES(${name.first}, $\u003cname.last\u003e, $/age/)', {\n    name: {first: 'John', last: 'Dow'},\n    age: 30\n});\n```\n\n**IMPORTANT:** Never use the reserved `${}` syntax inside ES6 template strings, as those have no knowledge of how to format values\nfor PostgreSQL. Inside ES6 template strings you should only use one of the 4 alternatives - `$()`, `$\u003c\u003e`, `$[]` or `$//`.\nIn general, you should either use the standard strings for SQL, or place SQL into external files - see [Query Files]. \n\nValid variable names are limited to the syntax of open-name JavaScript variables. And name `this` has special meaning - it refers\nto the formatting object itself (see below).\n\nKeep in mind that while property values `null` and `undefined` are both formatted as `null`, an error is thrown when the\nproperty does not exist.\n\n**`this` reference**\n\nProperty `this` refers to the formatting object itself, to be inserted as a JSON-formatted string.\n\n```js\nawait db.none('INSERT INTO documents(id, doc) VALUES(${id}, ${this})', {\n    id: 123,\n    body: 'some text'    \n})\n//=\u003e INSERT INTO documents(id, doc) VALUES(123, '{\"id\":123,\"body\":\"some text\"}')\n```    \n\n#### Nested Named Parameters\n\n[Named Parameters] support property name nesting of any depth.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/summary\u003e\n\n```js\nconst obj = {\n    one: {\n        two: {\n            three: {\n                value1: 123,\n                value2: a =\u003e {\n                    // a = obj.one.two.three\n                    return 'hello';\n                },\n                value3: function(a) {\n                    // a = this = obj.one.two.three\n                    return 'world';\n                },\n                value4: {\n                    toPostgres: a =\u003e {\n                        // Custom Type Formatting\n                        // a = obj.one.two.three.value4\n                        return a.text;\n                    },\n                    text: 'custom'\n                }                \n            }\n        }\n    }\n};\nawait db.one('SELECT ${one.two.three.value1}', obj); //=\u003e SELECT 123\nawait db.one('SELECT ${one.two.three.value2}', obj); //=\u003e SELECT 'hello'\nawait db.one('SELECT ${one.two.three.value3}', obj); //=\u003e SELECT 'world'\nawait db.one('SELECT ${one.two.three.value4}', obj); //=\u003e SELECT 'custom'\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nThe last name in the resolution can be anything, including:\n\n* the actual value (basic JavaScript type)\n* a function that returns:\n  - the actual value\n  - another function\n  - a [Custom Type Formatting] object\n* a [Custom Type Formatting] object that returns:\n  - the actual value\n  - another [Custom Type Formatting] object\n  - a function\n\ni.e. the resolution chain is infinitely flexible, and supports recursion without limits.\n\nPlease note, however, that nested parameters are not supported within the [helpers] namespace.\n\n## Formatting Filters\n\nBy default, all values are formatted according to their JavaScript type. Formatting filters (or modifiers),\nchange that, so the value is formatted differently.\n\nNote that formatting filters work only for normal queries, and are not available within [PreparedStatement] or\n[ParameterizedQuery], because those are, by definition, formatted on the server side.\n\nFilters use the same syntax for [Index Variables] and [Named Parameters], following immediately the variable name:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith Index Variables\u003c/b\u003e\u003c/summary\u003e\n\n```js\nawait db.any('SELECT $1:name FROM $2:name', ['price', 'products'])\n//=\u003e SELECT \"price\" FROM \"products\"\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith Named Parameters\u003c/b\u003e\u003c/summary\u003e\n\n```js\nawait db.any('SELECT ${column:name} FROM ${table:name}', {\n    column: 'price',\n    table: 'products'    \n});\n//=\u003e SELECT \"price\" FROM \"products\"\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nThe following filters are supported:\n\n* `:name` / `~` - [SQL Names]\n  - `:alias` - [Alias Filter]\n* `:raw` / `^` - [Raw Text]\n* `:value` / `#` - [Open Values]\n* `:csv` / `:list` - [CSV Filter]\n* `:json` - [JSON Filter]\n\n### SQL Names\n\nWhen a variable name ends with `:name`, or shorter syntax `~` (tilde), it represents an SQL name or identifier,\nto be escaped accordingly:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUsing ~ filter\u003c/b\u003e\u003c/summary\u003e\n\n```js\nawait db.query('INSERT INTO $1~($2~) VALUES(...)', ['Table Name', 'Column Name']);\n//=\u003e INSERT INTO \"Table Name\"(\"Column Name\") VALUES(...)\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUsing :name filter\u003c/b\u003e\u003c/summary\u003e\n\n```js\nawait db.query('INSERT INTO $1:name($2:name) VALUES(...)', ['Table Name', 'Column Name']);\n//=\u003e INSERT INTO \"Table Name\"(\"Column Name\") VALUES(...)\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nTypically, an SQL name variable is a text string, which must be at least 1 character long.\nHowever, `pg-promise` supports a variety of ways in which SQL names can be supplied:\n\n* A string that contains only `*` (asterisks) is automatically recognized as _all columns_:\n\n```js\nawait db.query('SELECT $1:name FROM $2:name', ['*', 'table']);\n//=\u003e SELECT * FROM \"table\"\n```\n\n* An array of strings to represent column names:\n\n```js\nawait db.query('SELECT ${columns:name} FROM ${table:name}', {\n    columns: ['column1', 'column2'],\n    table: 'table'\n});\n//=\u003e SELECT \"column1\",\"column2\" FROM \"table\"\n```\n\n* Any object that's not an array gets its properties enumerated for column names:\n\n```js\nconst obj = {\n    one: 1,\n    two: 2\n};\n\nawait db.query('SELECT $1:name FROM $2:name', [obj, 'table']);\n//=\u003e SELECT \"one\",\"two\" FROM \"table\"\n```\n\nIn addition, the syntax supports `this` to enumerate column names from the formatting object:\n \n```js\nconst obj = {\n    one: 1,\n    two: 2\n};\n\nawait db.query('INSERT INTO table(${this:name}) VALUES(${this:csv})', obj);\n//=\u003e INSERT INTO table(\"one\",\"two\") VALUES(1, 2)\n```\n\nRelying on this type of formatting for sql names and identifiers, along with regular variable formatting\nprotects your application from [SQL injection].\n\nMethod [as.name] implements the formatting.\n\n#### Alias Filter\n\nAn alias is a simpler, less-strict version of `:name` filter, which only supports a text string, i.e.\nit does not support `*`, `this`, array or object as inputs, like `:name` does. However, it supports other\npopular cases that are less strict, but cover at least 99% of all use cases, as shown below.   \n\n - It will skip adding surrounding double quotes when the name is a same-case single word:\n\n```js\nawait db.any('SELECT full_name as $1:alias FROM $2:name', ['name', 'table']);\n//=\u003e SELECT full_name as name FROM \"table\"\n```\n\n - It will automatically split the name into multiple SQL names when encountering `.`, and then\n escape each part separately, thus supporting auto-composite SQL names:\n\n```js\nawait db.any('SELECT * FROM $1:alias', ['schemaName.table']);\n//=\u003e SELECT * FROM \"schemaName\".table\n```\n\nFor more details see method [as.alias] that implements the formatting.\n\n### Raw Text\n\nWhen a variable name ends with `:raw`, or shorter syntax `^`, the value is to be injected as raw text, without escaping.\n\nSuch variables cannot be `null` or `undefined`, because of the ambiguous meaning in this case, and those values\nwill throw error `Values null/undefined cannot be used as raw text.`\n\n```js\nconst where = pgp.as.format('WHERE price BETWEEN $1 AND $2', [5, 10]); // pre-format WHERE condition\nawait db.any('SELECT * FROM products $1:raw', where);\n//=\u003e SELECT * FROM products WHERE price BETWEEN 5 AND 10\n```\n\nSpecial syntax `this:raw` / `this^` is supported, to inject the formatting object as raw JSON string.\n\n**WARNING:**\u003cbr/\u003e\nThis filter is unsafe, and should not be used for values that come from the client side, as it may result in [SQL injection].\n\n### Open Values\n\nWhen a variable name ends with `:value`, or shorter syntax `#`, it is escaped as usual, except when its type is a string,\nthe trailing quotes are not added.\n\nOpen values are primarily to be able to compose complete `LIKE`/`ILIKE` dynamic statements in external SQL files,\nwithout having to generate them in the code. They should not be used otherwise because they are not safe from SQL injection.\n\ni.e. you can either generate a filter like this in your code:\n\n```js\nconst name = 'John';\nconst filter = '%' + name + '%';\n```\n\nand then pass it in as a regular string variable, or you can pass in only `name`, and have your query use the\nopen-value syntax to add the extra search logic:\n\n```sql\nSELECT * FROM table WHERE name LIKE '%$1:value%')\n```\n\n**WARNING:**\u003cbr/\u003e\nThis filter is unsafe, and should not be used for values that come from the client side, as it may result in [SQL injection].\n\nMethod [as.value] implements the formatting.\n\n### JSON Filter\n\nWhen a variable name ends with `:json`, explicit JSON formatting is applied to the value.\n\nBy default, any object that's not `Date`, `Array`, `Buffer`, `null` or Custom-Type (see [Custom Type Formatting]),\nis automatically formatted as JSON.\n\nMethod [as.json] implements the formatting.\n\n### CSV Filter\n\nWhen a variable name ends with `:csv` or `:list`, it is formatted as a list of Comma-Separated Values, with each\nvalue formatted according to its JavaScript type.\n\nTypically, you would use this for a value that's an array, though it works for single values also. See the examples below.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUsing :csv filter\u003c/b\u003e\u003c/summary\u003e\n\n```js\nconst ids = [1, 2, 3];\nawait db.any('SELECT * FROM table WHERE id IN ($1:csv)', [ids])\n//=\u003e SELECT * FROM table WHERE id IN (1,2,3)\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUsing :list filter\u003c/b\u003e\u003c/summary\u003e\n\n```js\nconst ids = [1, 2, 3];\nawait db.any('SELECT * FROM table WHERE id IN ($1:list)', [ids])\n//=\u003e SELECT * FROM table WHERE id IN (1,2,3)\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nUsing automatic property enumeration:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eEnumeration with :csv filter\u003c/b\u003e\u003c/summary\u003e \n\n```js\nconst obj = {first: 123, second: 'text'};\n\nawait db.none('INSERT INTO table($1:name) VALUES($1:csv)', [obj])\n//=\u003e INSERT INTO table(\"first\",\"second\") VALUES(123,'text')\n\nawait db.none('INSERT INTO table(${this:name}) VALUES(${this:csv})', obj)\n//=\u003e INSERT INTO table(\"first\",\"second\") VALUES(123,'text')\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eEnumeration with :list filter\u003c/b\u003e\u003c/summary\u003e \n\n```js\nconst obj = {first: 123, second: 'text'};\n\nawait db.none('INSERT INTO table($1:name) VALUES($1:list)', [obj])\n//=\u003e INSERT INTO table(\"first\",\"second\") VALUES(123,'text')\n\nawait db.none('INSERT INTO table(${this:name}) VALUES(${this:list})', obj)\n//=\u003e INSERT INTO table(\"first\",\"second\") VALUES(123,'text')\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nMethod [as.csv] implements the formatting.\n\n## Custom Type Formatting\n\nThe library supports dual syntax for _CTF_ (Custom Type Formatting):\n\n* [Explicit CTF] - extending the object/type directly, for ease of use, while changing its signature;\n* [Symbolic CTF] - extending the object/type via [Symbol] properties, without changing its signature.\n\nThe library always first checks for the [Symbolic CTF], and if no such syntax is used, only then it checks for the [Explicit CTF].\n\n### Explicit CTF\n\nAny value/object that implements function `toPostgres` is treated as a custom-formatting type. The function is then called to get the actual value,\npassing it the object via `this` context, and plus as a single parameter (in case `toPostgres` is an ES6 arrow function):\n\n```js\nconst obj = {\n    toPostgres(self) {\n        // self = this = obj\n        \n        // return a value that needs proper escaping\n    }\n}\n```\n\nFunction `toPostgres` can return anything, including another object with its own `toPostgres` function, i.e. nested custom types are supported.\n\nThe value returned from `toPostgres` is escaped according to its JavaScript type, unless the object also contains property `rawType` set\nto a truthy value, in which case the returned value is considered pre-formatted, and thus injected directly, as [Raw Text]:\n\n```js\nconst obj = {\n    toPostgres(self) {\n        // self = this = obj\n        \n        // return a pre-formatted value that does not need escaping\n    },\n    rawType: true // use result from toPostgres directly, as Raw Text\n}\n```\n\nExample below implements a class that auto-formats `ST_MakePoint` from coordinates:\n\n```js\nclass STPoint {\n    constructor(x, y) {\n        this.x = x;\n        this.y = y;\n        this.rawType = true; // no escaping, because we return pre-formatted SQL\n    }\n    \n    toPostgres(self) {\n        return pgp.as.format('ST_MakePoint($1, $2)', [this.x, this.y]);\n    }\n}\n```\n\nAnd a classic syntax for such a class is even simpler:\n\n```js\nfunction STPoint(x, y){\n    this.rawType = true; // no escaping, because we return pre-formatted SQL\n    this.toPostgres = () =\u003e pgp.as.format('ST_MakePoint($1, $2)', [x, y]);\n}\n```\n\nWith this class you can use `new STPoint(12, 34)` as a formatting value that will be injected correctly.  \n\nYou can also use _CTF_ to override any standard type:\n\n```js\nDate.prototype.toPostgres = a =\u003e a.getTime();\n```\n\n### Symbolic CTF\n\nThe only difference from [Explicit CTF] is that we set `toPostgres` and `rawType` as ES6 [Symbol] properties,\ndefined in the [ctf] namespace: \n\n```js\nconst {toPostgres, rawType} = pgp.as.ctf; // Global CTF symbols\n\nconst obj = {\n    [toPostgres](self) {\n        // self = this = obj\n        \n        // return a pre-formatted value that does not need escaping\n    },\n    [rawType]: true // use result from toPostgres directly, as Raw Text\n};\n```\n\nAs CTF symbols are global, you can also configure objects independently of this library:\n\n```js\nconst ctf = {\n    toPostgres: Symbol.for('ctf.toPostgres'),\n    rawType: Symbol.for('ctf.rawType')\n};\n```\n\nOther than that, it works exactly as the [Explicit CTF], but without changing the object's signature.\n\nIf you do not know what it means, read the ES6 [Symbol] API and its use for unique property names.\nBut in short, [Symbol] properties are not enumerated via `for(name in obj)`, i.e. they are not generally\nvisible within JavaScript, only through specific API `Object.getOwnPropertySymbols`.\n\n## Query Files\n  \nUse of external SQL files (via [QueryFile]) offers many advantages:\n\n* Much cleaner JavaScript code, with all SQL kept in external files;\n* Much easier to write large and well-formatted SQL, with many comments and whole revisions;\n* Changes in external SQL can be automatically re-loaded (option `debug`), without restarting the app;\n* Pre-formatting SQL upon loading (option `params`), automating two-step SQL formatting;\n* Parsing and minifying SQL (options `minify` + `compress`), for early error detection and compact queries.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/summary\u003e\n\n```js\nconst {join: joinPath} = require('path');\n\n// Helper for linking to external query files:\nfunction sql(file) {\n    const fullPath = joinPath(__dirname, file);\n    return new pgp.QueryFile(fullPath, {minify: true});\n}\n\n// Create a QueryFile globally, once per file:\nconst sqlFindUser = sql('./sql/findUser.sql');\n\ndb.one(sqlFindUser, {id: 123})\n    .then(user =\u003e {\n        console.log(user);\n    })\n    .catch(error =\u003e {\n        if (error instanceof pgp.errors.QueryFileError) {\n            // =\u003e the error is related to our QueryFile\n        }\n    });\n```\n\nFile `findUser.sql`:\n\n```sql\n/*\n    multi-line comments are supported\n*/\nSELECT name, dob -- single-line comments are supported\nFROM Users\nWHERE id = ${id}\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nEvery query method of the library can accept type [QueryFile] as its `query` parameter.\nType [QueryFile] never throws any error, leaving it for query methods to gracefully reject with [QueryFileError].\n\nUse of [Named Parameters] within external SQL files is recommended over the [Index Variables], because it makes the SQL\nmuch easier to read and understand, and because it also allows [Nested Named Parameters], so variables in a large\nand complex SQL file can be grouped in namespaces for even easier visual separation.\n\n## Tasks\n\nA [task] represents a shared connection for executing multiple queries:\n\n```js\ndb.task(t =\u003e {\n    // execute a chain of queries against the task context, and return the result:\n    return t.one('SELECT count(*) FROM events WHERE id = $1', 123, a =\u003e +a.count)\n        .then(count =\u003e {\n            if(count \u003e 0) {\n                return t.any('SELECT * FROM log WHERE event_id = $1', 123)\n                    .then(logs =\u003e {\n                        return {count, logs};\n                    })\n            }\n            return {count};\n        });    \n})\n    .then(data =\u003e {\n        // success, data = either {count} or {count, logs}\n    })\n    .catch(error =\u003e {\n        // failed    \n    });\n```\n\nTasks provide a shared connection context for its callback function, to be released when finished, and\nthey must be used whenever executing more than one query at a time. See also [Chaining Queries] to understand\nthe importance of using tasks.\n\nYou can optionally tag tasks (see [Tags]), and use ES7 async syntax:\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eWith ES7 async\u003c/b\u003e\u003c/summary\u003e\n  \n```js\ndb.task(async t =\u003e {\n    const count = await t.one('SELECT count(*) FROM events WHERE id = $1', 123, a =\u003e +a.count);\n    if(count \u003e 0) {\n        const logs = await t.any('SELECT * FROM log WHERE event_id = $1', 123);\n        return {count, logs};\n    }\n    return {count};\n})\n    .then(data =\u003e {\n        // success, data = either {count} or {count, logs}\n    })\n    .catch(error =\u003e {\n        // failed    \n    });\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eWith ES7 async + tag\u003c/b\u003e\u003c/summary\u003e\n  \n```js\ndb.task('get-event-logs', async t =\u003e {\n    const count = await t.one('SELECT count(*) FROM events WHERE id = $1', 123, a =\u003e +a.count);\n    if(count \u003e 0) {\n        const logs = await t.any('SELECT * FROM log WHERE event_id = $1', 123);\n        return {count, logs};\n    }\n    return {count};\n})\n    .then(data =\u003e {\n        // success, data = either {count} or {count, logs}\n    })\n    .catch(error =\u003e {\n        // failed    \n    });\n```\n\n\u003c/details\u003e\n\n### Conditional Tasks\n\nMethod [taskIf] creates a new task only when required, according to the condition. \n\nThe default condition is to start a new task only when necessary, such as on the top level.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith default condition\u003c/b\u003e\u003c/summary\u003e\n \n```js\ndb.taskIf(t1 =\u003e {\n    // new task has started, as the top level doesn't have one\n    return t1.taskIf(t2 =\u003e {\n        // Task t1 is being used, according to the default condition\n        // t2 = t1\n    });\n})\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith a custom condition - value\u003c/b\u003e\u003c/summary\u003e\n \n```js\ndb.taskIf({cnd: false}, t1 =\u003e {\n    // new task is created, i.e. option cnd is ignored here,\n    // because the task is required on the top level\n    return t1.taskIf({cnd: true}, t2 =\u003e {\n        // new task created, because we specified that we want one;\n        // t2 != t1\n    });\n})\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith a custom condition - callback\u003c/b\u003e\u003c/summary\u003e\n \n```js\nconst cnd = c =\u003e {\n    // c.ctx - task/tx context (not available on the top level)\n    // default condition: return !c.ctx;\n    return someValue;\n};\n\ndb.taskIf({cnd}, t1 =\u003e {\n    // new task is always created, because it is required on the top level\n    return t1.taskIf({cnd}, t2 =\u003e {\n        // if someValue is truthy, a new task is created (t2 != t1);\n        // otherwise, we continue with the containing task (t2 = t1).\n    });\n})\n```\n\u003c/details\u003e\n\n## Transactions\n\nTransaction method [tx] is like [task], which also executes `BEGIN` + `COMMIT`/`ROLLBACK`:\n\n```js\ndb.tx(t =\u003e {\n    // creating a sequence of transaction queries:\n    const q1 = t.none('UPDATE users SET active = $1 WHERE id = $2', [true, 123]);\n    const q2 = t.one('INSERT INTO audit(entity, id) VALUES($1, $2) RETURNING id', ['users', 123]);\n\n    // returning a promise that determines a successful transaction:\n    return t.batch([q1, q2]); // all of the queries are to be resolved;\n})\n    .then(data =\u003e {\n        // success, COMMIT was executed\n    })\n    .catch(error =\u003e {\n        // failure, ROLLBACK was executed\n    });\n```\n\nIf the callback function returns a rejected promise or throws an error, the method will automatically execute `ROLLBACK` at the end. \nIn all other cases the transaction will be automatically closed by `COMMIT`.\n\nThe same as tasks, transactions support [Tags] and ES7 `async`:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith ES7 async\u003c/b\u003e\u003c/summary\u003e\n\n```js\ndb.tx(async t =\u003e {\n    await t.none('UPDATE users SET active = $1 WHERE id = $2', [true, 123]);\n    await t.one('INSERT INTO audit(entity, id) VALUES($1, $2) RETURNING id', ['users', 123]);\n})\n    .then(data =\u003e {\n        // success, COMMIT was executed\n    })\n    .catch(error =\u003e {\n        // failure, ROLLBACK was executed\n    });\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith ES7 async + tag\u003c/b\u003e\u003c/summary\u003e\n\n```js\ndb.tx('update-user', async t =\u003e {\n    await t.none('UPDATE users SET active = $1 WHERE id = $2', [true, 123]);\n    await t.one('INSERT INTO audit(entity, id) VALUES($1, $2) RETURNING id', ['users', 123]);\n})\n    .then(data =\u003e {\n        // success, COMMIT was executed\n    })\n    .catch(error =\u003e {\n        // failure, ROLLBACK was executed\n    });\n```\n\n\u003c/details\u003e\n\n### Nested Transactions\n\nNested transactions automatically share the connection between all levels.\nThis library sets no limitation as to the depth (nesting levels) of transactions supported.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/summary\u003e\n\n```js\ndb.tx(t =\u003e {\n    const queries = [\n        t.none('DROP TABLE users;'),\n        t.none('CREATE TABLE users(id SERIAL NOT NULL, name TEXT NOT NULL)')\n    ];\n    for (let i = 1; i \u003c= 100; i++) {\n        queries.push(t.none('INSERT INTO users(name) VALUES($1)', 'name-' + i));\n    }\n    queries.push(\n        t.tx(t1 =\u003e {\n            return t1.tx(t2 =\u003e {\n                return t2.one('SELECT count(*) FROM users');\n            });\n        }));\n    return t.batch(queries);\n})\n    .then(data =\u003e {\n        // success\n    })\n    .catch(error =\u003e {\n        // failure\n    });\n```\n\u003c/details\u003e\n\u003cbr/\u003e\n\nIf you want to avoid automatic occurrence of nested transactions, see [Conditional Transactions].\n\n#### Limitations\n\nIt is important to know that PostgreSQL does not support full/atomic nested transactions, it only\nsupports [savepoints](http://www.postgresql.org/docs/9.6/static/sql-savepoint.html) inside top-level\ntransactions, to allow *partial rollbacks*.\n\nPostgres uses `BEGIN` with `COMMIT / ROLLBACK` for top-level transactions, and `SAVEPOINT name`\nwith `RELEASE / ROLLBACK TO name` for inner save-points.\n\nThis library automatically executes all such transaction and savepoint commands, with unique\nsavepoint names, based on the transaction level, plus index within the current level, in the\nform of `sp_x_y`.\n\nIn the name, `x` is the transaction level, starting with `1` (because `0` is the top-level\ntransaction that does not use savepoints). And `y` represents sub-transaction order/index\nwithin the current level, starting with `1`. So the first savepoint on the top level will\nbe named `sp_1_1`.\n\n### Configurable Transactions\n\n[TransactionMode] type can extend your `BEGIN` command with transaction configuration:\n\n```js\nconst {TransactionMode, isolationLevel} = pgp.txMode;\n \n// Create a reusable transaction mode (serializable + read-only + deferrable):\nconst mode = new TransactionMode({\n    tiLevel: isolationLevel.serializable,\n    readOnly: true,\n    deferrable: true\n});\n\ndb.tx({mode}, t =\u003e {\n    // do transaction queries here\n})\n    .then(() =\u003e {\n        // success;\n    })\n    .catch(error =\u003e {\n        // failure    \n    });\n```\n\nInstead of the default `BEGIN`, such transaction will open with the following command:\n```\nBEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE\n```\n\n_Transaction Mode_ is set via option `mode`, preceding the callback function. See methods [tx] and [txIf].\n\nThis is the most efficient and best-performing way of configuring transactions. In combination with\n*Transaction Snapshots* you can make the most out of transactions in terms of performance and concurrency.\n\n### Conditional Transactions\n\nMethod [txIf] executes a transaction / [tx] when a specified condition is met, or else it executes a [task]. \n\nWhen no condition is specified, the default is to start a transaction, if currently not in one, or else it starts a task.\nIt is useful when you want to avoid [Nested Transactions] - savepoints.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith default condition\u003c/b\u003e\u003c/summary\u003e\n \n```js\ndb.txIf(t =\u003e {\n    // transaction is started, as the top level doesn't have one\n    return t.txIf(t2 =\u003e {\n        // a task is started, because there is a parent transaction        \n    });\n})\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith a custom condition - value\u003c/b\u003e\u003c/summary\u003e\n\n```js\ndb.txIf({cnd: someValue}, t =\u003e {\n    // if condition is truthy, a transaction is started\n    return t.txIf(t2 =\u003e {\n        // a task is started, if the parent is a transaction\n        // a transaction is started, if the parent is a task\n    });\n})\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWith a custom condition - callback\u003c/b\u003e\u003c/summary\u003e\n\n```js\nconst cnd = c =\u003e {\n    // c.ctx - task/transaction context (not available on the top level)\n    // default condition: return !c.ctx || !c.ctx.inTransaction;\n    return someValue;\n};\n\ndb.txIf({cnd}, t =\u003e {\n    // if condition is truthy, a transaction is started\n    return t.txIf(t2 =\u003e {\n        // a task is started, if the parent is a transaction\n        // a transaction is started, if the parent is a task\n    });\n})\n```\n\u003c/details\u003e\n\n## Library de-initialization\n\nThis library manages all database connections via the [connection pool], which internally caches them.\n\nConnections in the cache expire due to inactivity after [idleTimeoutMillis] number of milliseconds, which you\ncan set only when creating the [Database] object. \n\nWhile there is a single open connection in the pool, the process cannot terminate by itself, only via `process.exit()`,\nunless `allowExitOnIdle` is used - see update section below.\nIf you want the process to finish by itself, without waiting for all connections in the pool to expire, you need\nto force the pool to shut down all the connections it holds:\n\n```js\ndb.$pool.end(); // shuts down the connection pool associated with the Database object\n``` \n\nFor example, you can chain the last promise in the process like this:\n\n```js\n.finally(db.$pool.end);\n``` \n\n**IMPORTANT:** Note that if your app is an HTTP service, or generally an application that does not feature any exit point,\nthen you should not do any de-initialization at all. It is only if your app is a run-through process/utility, then you\nmight want to use it, so the process ends without delays.  \n\nIn applications that either use multiple databases or execute a multi-pool strategy for balanced query loads, you would end up\nwith multiple [Database] objects, each with its own connection pool. In this scenario, in order to exit the process normally,\nat a particular point, you can call [pgp.end] to shut down all connection pools at once:\n\n```js\npgp.end(); // shuts down all connection pools created in the process\n```\n\nor promise-chained to the last query block in the process:\n\n```js\n.finally(pgp.end);\n``` \n\nOnce you have shut down the pool associated with your [Database] object, you can no longer use the object, and any of its query methods\nwill be rejecting with [Error] = `Connection pool of the database object has been destroyed`.\n\nSee the relevant API: [pgp.end], [Database.$pool]\n\n\u003c!-- Internal Menu Links --\u003e\n\n[Usage]:#usage\n[Index Variables]:#index-variables  \n[Named Parameters]:#named-parameters\n[Nested Named Parameters]:#nested-named-parameters\n[SQL Names]:#sql-names\n[Raw Text]:#raw-text\n[Open Values]:#open-values\n[Alias Filter]:#alias-filter\n[JSON Filter]:#json-filter\n[CSV Filter]:#csv-filter\n[Custom Type Formatting]:#custom-type-formatting\n[Explicit CTF]:#explicit-ctf\n[Symbolic CTF]:#symbolic-ctf\n[Tasks]:#tasks    \n[Transactions]:#transactions\n[Nested Transactions]:#nested-transactions    \n[Limitations]:#limitations   \n[Configurable Transactions]:#configurable-transactions\n[Conditional Tasks]:#conditional-tasks\n[Conditional Transactions]:#conditional-transactions  \n[Library de-initialization]:#library-de-initialization\n[Query Files]:#query-files\n\n\u003c!-- Internal Page Links --\u003e\n\n[Contribution Notes]:.github/CONTRIBUTING.md\n[CHANGELOG]:.github/CHANGELOG.md\n\n\u003c!-- Database Method Links --\u003e\n\n[query]:https://vitaly-t.github.io/pg-promise/Database.html#query\n[none]:https://vitaly-t.github.io/pg-promise/Database.html#none\n[one]:https://vitaly-t.github.io/pg-promise/Database.html#one\n[oneOrNone]:https://vitaly-t.github.io/pg-promise/Database.html#oneOrNone\n[many]:https://vitaly-t.github.io/pg-promise/Database.html#many\n[manyOrNone]:https://vitaly-t.github.io/pg-promise/Database.html#manyOrNone\n[any]:https://vitaly-t.github.io/pg-promise/Database.html#any\n[result]:https://vitaly-t.github.io/pg-promise/Database.html#result\n[multi]:https://vitaly-t.github.io/pg-promise/Database.html#multi\n[multiResult]:https://vitaly-t.github.io/pg-promise/Database.html#multiResult\n[map]:https://vitaly-t.github.io/pg-promise/Database.html#map\n[each]:https://vitaly-t.github.io/pg-promise/Database.html#each\n[func]:https://vitaly-t.github.io/pg-promise/Database.html#func\n[proc]:https://vitaly-t.github.io/pg-promise/Database.html#proc\n[stream]:https://vitaly-t.github.io/pg-promise/Database.html#stream\n[connect]:https://vitaly-t.github.io/pg-promise/Database.html#connect\n[task]:https://vitaly-t.github.io/pg-promise/Database.html#task\n[taskIf]:https://vitaly-t.github.io/pg-promise/Database.html#taskIf\n[tx]:https://vitaly-t.github.io/pg-promise/Database.html#tx\n[txIf]:https://vitaly-t.github.io/pg-promise/Database.html#txIf\n[batch]:https://vitaly-t.github.io/pg-promise/Task.html#batch\n[sequence]:https://vitaly-t.github.io/pg-promise/Task.html#sequence\n[page]:https://vitaly-t.github.io/pg-promise/Task.html#page\n[extend]:https://vitaly-t.github.io/pg-promise/global.html#event:extend\n\n\u003c!-- API Links --\u003e\n\n[Official Documentation]:https://vitaly-t.github.io/pg-promise/index.html\n[Initialization Options]:https://vitaly-t.github.io/pg-promise/module-pg-promise.html\n[helpers]:https://vitaly-t.github.io/pg-promise/helpers.html\n[QueryFile]:https://vitaly-t.github.io/pg-promise/QueryFile.html\n[QueryFileError]:https://vitaly-t.github.io/pg-promise/errors.QueryFileError.html\n[Database]:https://vitaly-t.github.io/pg-promise/Database.html\n[Database.$pool]:https://vitaly-t.github.io/pg-promise/Database.html#$pool\n[pgp.end]:https://vitaly-t.github.io/pg-promise/module-pg-promise.html#~end\n[formatting]:https://vitaly-t.github.io/pg-promise/formatting.html\n[ctf]:https://vitaly-t.github.io/pg-promise/formatting.ctf.html\n[as.format]:https://vitaly-t.github.io/pg-promise/formatting.html#.format\n[format]:https://vitaly-t.github.io/pg-promise/formatting.html#.format\n[as.value]:https://vitaly-t.github.io/pg-promise/formatting.html#.value\n[as.csv]:https://vitaly-t.github.io/pg-promise/formatting.html#.csv\n[as.json]:https://vitaly-t.github.io/pg-promise/formatting.html#.json\n[as.name]:https://vitaly-t.github.io/pg-promise/formatting.html#.name\n[as.alias]:https://vitaly-t.github.io/pg-promise/formatting.html#.alias\n[TransactionMode]:https://vitaly-t.github.io/pg-promise/txMode.TransactionMode.html\n[PreparedStatement]:https://vitaly-t.github.io/pg-promise/PreparedStatement.html\n[ParameterizedQuery]:https://vitaly-t.github.io/pg-promise/ParameterizedQuery.html\n\n\u003c!-- WiKi Links --\u003e\n\n[Learn by Example]:https://github.com/vitaly-t/pg-promise/wiki/Learn-by-Example\n[Chaining Queries]:https://github.com/vitaly-t/pg-promise/wiki/Chaining-Queries\n[Tags]:https://github.com/vitaly-t/pg-promise/wiki/Tags\n\n\u003c!-- External Links --\u003e\n\n[node-postgres]:https://github.com/brianc/node-postgres\n[SQL injection]:https://en.wikipedia.org/wiki/SQL_injection\n[Symbol]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol\n[idleTimeoutMillis]:https://github.com/brianc/node-postgres/blob/master/packages/pg/lib/defaults.js\n[connection pool]:https://github.com/brianc/node-postgres/tree/master/packages/pg-pool\n[Error]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaly-t%2Fpg-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitaly-t%2Fpg-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaly-t%2Fpg-promise/lists"}