New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@postgres-queries/builder

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postgres-queries/builder

Query builder for PostgreSQL in Node.js, built for async

latest
npmnpm
Version
0.2.1
Version published
Maintainers
5
Created
Source

Queries Builder

All query factories function takes an object as a parameter, containing the following keys:

  • table: table name on which operate the query,
  • permanentFilters: query filters provided to each underlying queries, as a plain object

Count

Build a COUNT(*) query.

import { countAll } from "postgres-queries-builder";

const countQuery = countAll({
  table: "user",
  permanentFilters: {
    active: 1
  }
});

countQuery({
  filter: {
    department: "HR"
  }
});

// SELECT COUNT(*) FROM user WHERE active = 1 AND departement = "HR"

The countQuery takes an extra object parameter whose keys are:

  • filter: extra filter to apply to the query, as a plain object

FAQs

Package last updated on 12 Dec 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