Socket
Book a DemoInstallSign in
Socket

pg-minify

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-minify

Minifies PostgreSQL scripts.

0.3.0
Source
npmnpm
Version published
Maintainers
1
Created

What is pg-minify?

pg-minify is an npm package designed to minify SQL queries. It removes unnecessary whitespace, comments, and other non-essential elements from SQL code, making it more compact and potentially improving performance when sending queries to a PostgreSQL database.

What are pg-minify's main functionalities?

Minify SQL Queries

This feature allows you to minify a given SQL query by removing unnecessary whitespace and comments. The example demonstrates how to use pg-minify to minify a simple SQL query.

const pgMinify = require('pg-minify');
const sql = 'SELECT * FROM users WHERE id = $1; -- Get user by ID';
const minifiedSQL = pgMinify(sql);
console.log(minifiedSQL); // Outputs: 'SELECT * FROM users WHERE id=$1;'

Error Handling

pg-minify provides error handling capabilities to catch and handle any issues that arise during the minification process. The example shows how to wrap the minification process in a try-catch block to handle potential errors.

const pgMinify = require('pg-minify');
try {
  const sql = 'SELECT * FROM users WHERE id = $1; -- Get user by ID';
  const minifiedSQL = pgMinify(sql);
  console.log(minifiedSQL);
} catch (error) {
  console.error('Error minifying SQL:', error);
}

Other packages similar to pg-minify

Keywords

minify SQL

FAQs

Package last updated on 23 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.