{"id":13425916,"url":"https://github.com/gajus/pg-formatter","last_synced_at":"2025-05-16T18:11:01.470Z","repository":{"id":37493338,"uuid":"93439921","full_name":"gajus/pg-formatter","owner":"gajus","description":"A PostgreSQL SQL syntax beautifier.","archived":false,"fork":false,"pushed_at":"2025-03-28T22:13:39.000Z","size":716,"stargazers_count":80,"open_issues_count":3,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-03T21:11:16.968Z","etag":null,"topics":["postgresql","pretty"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gajus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"gajus","patreon":"gajus"}},"created_at":"2017-06-05T19:41:41.000Z","updated_at":"2025-03-18T17:31:02.000Z","dependencies_parsed_at":"2024-01-18T09:05:01.363Z","dependency_job_id":"959e30ff-2431-49b4-8ed1-416d1b3af7a6","html_url":"https://github.com/gajus/pg-formatter","commit_stats":{"total_commits":49,"total_committers":7,"mean_commits":7.0,"dds":"0.26530612244897955","last_synced_commit":"6e1c8aff43ceaad27364e5628d11a7a68b3bec8b"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fpg-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fpg-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fpg-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gajus%2Fpg-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gajus","download_url":"https://codeload.github.com/gajus/pg-formatter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248607137,"owners_count":21132481,"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":["postgresql","pretty"],"created_at":"2024-07-31T00:01:21.973Z","updated_at":"2025-04-12T17:40:02.086Z","avatar_url":"https://github.com/gajus.png","language":"TypeScript","funding_links":["https://github.com/sponsors/gajus","https://patreon.com/gajus"],"categories":["JavaScript","TypeScript","Compiled list","Utilities"],"sub_categories":["plv8:"],"readme":"# pg-formatter\n\n[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)\n[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social\u0026label=Follow)](https://twitter.com/kuizinas)\n\nA PostgreSQL SQL syntax beautifier.\n\n\u003e Note:\n\u003e\n\u003e This project is a thin wrapper of https://github.com/darold/pgFormatter.\n\u003e Execution of the module relies on Perl being available on the host system.\n\n## Usage\n\n```js\nimport {\n  format\n} from 'pg-formatter';\n\nformat(`SELECT foo FROM bar`);\n\n```\n\n## Configuration\n\n|Configuration|Format|Default|Description|`pgFormatter` equivalent|\n|---|---|---|---|---|\n|`anonymize`|boolean|`false`|Obscure all literals in queries, useful to hide confidential data before formatting.|`anonymize`|\n|`commaBreak`|boolean|`false`|Add a newline after each comma in an insert statement.|`comma-break`|\n|`functionCase`|string (\"unchanged\", \"lowercase\", \"uppercase\", \"capitalize\")|`unchanged`|Change the case of the function names.|`function-case`|\n|`keywordCase`|string (\"unchanged\", \"lowercase\", \"uppercase\", \"capitalize\")|`unchanged`|Change the case of the reserved keyword.|`keyword-case`|\n|`noRcFile`|boolean|`false`|Do not read ~/.pg_format automatically.|`no-rcfile`|\n|`placeholder`|string (regex)|N/A|Regex to find code that must not be changed.|`placeholder`|\n|`spaces`|number|`4`|Number of spaces to indent the code.|`spaces`|\n|`stripComments`|boolean|`false`|Remove any comment from SQL code.|`nocomment`|\n|`tabs`|boolean|`false`|Use tabs instead of spaces. When `true`, the `spaces` option is ignored.|`tabs`|\n\n## CLI Usage\n\n```bash\n$ npm install pg-formatter -g\n$ pg-formatter --help\nFormats SQL files\n\nOptions:\n      --version         Show version number                            [boolean]\n      --anonymize       Obscure all literals in queries, useful to hide\n                        confidential data before formatting.\n                                                      [boolean] [default: false]\n      --comma-break     Add a newline after each comma in an insert statement.\n                                                      [boolean] [default: false]\n      --function-case   Change the case of the function names.\n         [string] [choices: \"unchanged\", \"lowercase\", \"uppercase\", \"capitalize\"]\n                                                          [default: \"unchanged\"]\n  -i, --inplace         Override input file with formatted content.\n                                                      [boolean] [default: false]\n      --keyword-case    Change the case of the reserved keyword.\n         [string] [choices: \"unchanged\", \"lowercase\", \"uppercase\", \"capitalize\"]\n                                                          [default: \"unchanged\"]\n      --no-rc-file      Do not read ~/.pg_format automatically.\n                                                      [boolean] [default: false]\n      --placeholder     Regex to find code that must not be changed.    [string]\n      --spaces          Number of spaces to indent the code.\n                                                           [number] [default: 4]\n      --strip-comments  Remove any comment from SQL code.\n                                                      [boolean] [default: false]\n      --tabs            Use tabs instead of spaces. When true, the spaces option\n                        is ignored.                   [boolean] [default: false]\n      --help            Show help                                      [boolean]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fpg-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgajus%2Fpg-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgajus%2Fpg-formatter/lists"}