FaasJS
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security

Documents / @faasjs/pg

@faasjs/pg

@faasjs/pg

A TypeScript-first PostgreSQL query builder and migration toolkit built on top of postgres.js.

The package exposes:

  • cached Client instances created with createClient and resolved with getClient;
  • a fluent QueryBuilder for parameterized SELECT, INSERT, UPDATE, DELETE, and upsert calls;
  • schema and migration helpers for test and application database setup;
  • declaration-merging types such as Tables, TableName, and ColumnName.

Prefer query-builder methods or Client.raw parameters for runtime values. Helpers such as rawSql, whereRaw, orderByRaw, and schema raw() methods accept trusted SQL text and should only be used for fragments controlled by the application.

Install

npm install @faasjs/pg

Functions

  • createClient
  • createTemplateStringsArray
  • escapeIdentifier
  • escapeValue
  • getClient
  • getClients
  • isNormalOperator
  • isOperator
  • isTemplateStringsArray
  • rawSql
  • registerDatabaseBootstrap
  • resolveDatabaseBootstrap

Classes

  • Client
  • Migrator
  • QueryBuilder
  • SchemaBuilder
  • TableBuilder

Interfaces

  • Tables

Type Aliases

  • ArrayOperators
  • ClientOptions
  • ColumnName
  • ColumnValue
  • DatabaseBootstrap
  • InferTResult
  • JoinCondition
  • JsonOperators
  • JsonSelectField
  • NormalOperators
  • NullOperators
  • Operator
  • Operators
  • OrderByCondition
  • PatternOperators
  • QueryOrderDirection
  • QueryOrderDirections
  • RawSql
  • TableName
  • TableType
  • WhereCondition