Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-hstore

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-hstore

A module for serializing and deserializing JSON data into hstore format

  • 2.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
352K
increased by6.1%
Maintainers
1
Weekly downloads
 
Created

What is pg-hstore?

The pg-hstore npm package is a node.js library for serializing and deserializing JSON data to hstore format for use with PostgreSQL. Hstore is a key-value store within PostgreSQL that allows for the storage of sets of key-value pairs within a single PostgreSQL value.

What are pg-hstore's main functionalities?

Serialize JSON to hstore format

This feature allows you to convert a JSON object into an hstore string format that can be stored in a PostgreSQL database.

const hstore = require('pg-hstore')();
const obj = { key1: 'value1', key2: 'value2' };
hstore.stringify(obj, function(err, hstoreValue) {
  console.log(hstoreValue); // Output: '"key1"=>"value1", "key2"=>"value2"'
});

Deserialize hstore format to JSON

This feature allows you to convert an hstore string from a PostgreSQL database back into a JSON object.

const hstore = require('pg-hstore')();
const hstoreValue = '"key1"=>"value1", "key2"=>"value2"';
hstore.parse(hstoreValue, function(err, result) {
  console.log(result); // Output: { key1: 'value1', key2: 'value2' }
});

Other packages similar to pg-hstore

Keywords

FAQs

Package last updated on 09 Jun 2021

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc