1.3.1 • Published 3 years ago

@curvewise-public/pg-formatter v1.3.1

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
3 years ago

pg-formatter

Travis build status Coveralls NPM version Canonical Code Style Twitter Follow

A PostgreSQL SQL syntax beautifier.

Note:

This project is a thin wrapper of https://github.com/darold/pgFormatter. Execution of the module relies on Perl being available on the host system.

Usage

import {
  format
} from 'pg-formatter';

format(`SELECT foo FROM bar`);

Configuration

ConfigurationFormatDefaultDescriptionpgFormatter equivalent
anonymizebooleanfalseObscure all literals in queries, useful to hide confidential data before formatting.anonymize
functionCasestring ("unchanged", "lowercase", "uppercase", "capitalize")unchangedChange the case of the function names.function-case
keywordCasestring ("unchanged", "lowercase", "uppercase", "capitalize")unchangedChange the case of the reserved keyword.keyword-case
noRcFilebooleanfalseDo not read ~/.pg_format automatically.no-rcfile
placeholderstring (regex)N/ARegex to find code that must not be changed.placeholder
spacesnumber4Number of spaces to indent the code.spaces
stripCommentsbooleanfalseRemove any comment from SQL code.nocomment
tabsbooleanfalseUse tabs instead of spaces. When true, the spaces option is ignored.tabs