Socket
Socket
Sign inDemoInstall

pg-connection-string

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pg-connection-string

Functions for dealing with a PostgresSQL connection string


Version published
Weekly downloads
7.4M
increased by0.54%
Maintainers
1
Created
Weekly downloads
 

Package description

What is pg-connection-string?

The pg-connection-string package is a utility for parsing PostgreSQL connection strings. It can parse a connection string into an object with configuration details, which can then be used to establish a connection to a PostgreSQL database. This is particularly useful when working with environment variables or configuration files that store database connection information in a URI format.

What are pg-connection-string's main functionalities?

Parsing connection string

This feature allows you to parse a PostgreSQL connection string into a configuration object. The object includes properties such as user, password, host, port, and database, which can be used to establish a connection to a PostgreSQL database.

const { parse } = require('pg-connection-string');

const config = parse('postgres://user:password@localhost:5432/database');

console.log(config);

Other packages similar to pg-connection-string

Changelog

Source

v2.0.0

  • Properly handle various PostgreSQL to JavaScript type conversions to avoid data loss:
PostgreSQL | pg@v2.0 JavaScript | pg@v1.0 JavaScript
--------------------------------|----------------
float4     | number (float)     | string
float8     | number (float)     | string
int8       | string             | number (int)
numeric    | string             | number (float)
decimal    | string             | number (float)

For more information see https://github.com/brianc/node-postgres/pull/353 If you are unhappy with these changes you can always override the built in type parsing fairly easily.

Readme

Source

pg-connection-string

NPM

Build Status Coverage Status

Functions for dealing with a PostgresSQL connection string

parse method taken from node-postgres Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com) MIT License

Usage

var parse = require('pg-connection-string').parse;

var config = parse('postgres://someuser:somepassword@somehost:381/somedatabase')

Keywords

FAQs

Last updated on 30 Aug 2017

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc