@oly_op/uuid-dashes
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

pg-helpers

A wrapper library for the pg npm package.

Installation

npm install @oly_op/pg-helpers

Usage

The package exports helpers which you can import individually.

import { query, parseTable } from "@oly_op/pg-helpers"

API

Query function

  • query

Result parsing helpers:

  • parseRow
  • parseTable
  • getResRow
  • getRowCount
  • getResExists
  • getRowCountOrNull
  • isResEmpty
  • convertToCamelCase
  • convertToSnakeCase

Types:

import type { Pool, PoolClient, QueryResult } from "pg"

export type Client = Pool | PoolClient

export type QueryRes<T = Record<string, unknown>> = QueryResult<T>

export type Parse<T> = (res: QueryRes) => T

export interface Variable {
	key: string,
	string?: boolean,
	parameterized?: boolean,
	value: string | number | boolean | null,
}

Readme

Keywords

none

Package Sidebar

Install

npm i @oly_op/uuid-dashes

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

3.58 kB

Total Files

5

Last publish

Collaborators

  • oly_op