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

@knorm/postgres

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knorm/postgres

Postgres plugin for knorm

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
204
decreased by-88.13%
Maintainers
1
Weekly downloads
 
Created
Source

@knorm/postgres

npm version build status coverage status dependency status Greenkeeper badge

Postgres plugin for @knorm/knorm that enables running queries agaisnt postgres. Also, it adds postgres-specific features such as:

  • automatically JSON-stringifying all json and jsonb fields before save (insert or update)
  • automatically validating all string fields with maxLength: 255
  • limit, offset, returning query options and ilike where option, via sql-bricks-postgres
  • updating multiple rows using a single query with UPDATE FROM, via sql-bricks-postgres
  • connection pooling, via pg
  • transactions

Installation

npm install --save @knorm/knorm @knorm/postgres

@knorm/postgres has a peer dependency on @knorm/knorm

Usage

const knorm = require('@knorm/knorm');
const knormPostgres = require('@knorm/postgres');

const orm = knorm({
  // knorm options
}).use(
  knormPostgres({
    // knormPostgres options
  })
);

Options

OptionTypeDescription
namestringthe name of the plugin, defaults to 'postgres'
connectionobject or stringif set, this option is passed directly to pg. However, connections can also be configured via environment variables
initClient(async) functiona function called when a new client is acquired from the pool. useful for configuring the connection e.g. setting session variables. it's called with the client as the only argument
restoreClient(async) functiona function called before a client is released back into the pool. useful for restoring a client e.g. unsetting session variables. it's called with the client as the only argument

NOTE that all options are optional.

Keywords

FAQs

Package last updated on 06 Jul 2018

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