16.3.0 • Published 8 months ago

libpg-query v16.3.0

Weekly downloads
-
License
LICENSE IN LICENS...
Repository
github
Last release
8 months ago

libpg-query

The real PostgreSQL parser, exposed for nodejs.

Primarily used for the node.js parser and deparser pgsql-parser

Table of Contents

  1. Installation
  2. Example
  3. Documentation
  4. Versions
  5. Building a binary distribution
  6. Related Projects
  7. Credit

Installation

npm install libpg-query

Example

const parser = require('libpg-query');
parser.parseQuery('select 1').then(console.log);

Documentation

query.parseQuery(sql)/parseQuerySync

Parses the sql and returns a Promise for the parse tree (or returns the parse tree directly in the sync version). May reject with/throw a parse error.

The return value is an array, as multiple queries may be provided in a single string (semicolon-delimited, as Postgres expects).

query.parsePlPgSQL(funcsSql)/query.parsePlPgSQLSync(funcsSql)

Parses the contents of a PL/PGSql function, from a CREATE FUNCTION declaration, and returns a Promise for the parse tree (or returns the parse tree directly in the sync version). May reject with/throw a parse error.

Versions

Our latest is built with 16-latest branch from libpg_query

PG Major Versionlibpg_queryBranchnpm
1616-latest16-latestlibpg-query@16.2.0
1515-latest15-latestlibpg-query@15.1.0
1414-latest14-latestlibpg-query@14.0.0
1313-latest13-latestlibpg-query@13.3.1
12(n/a)
11(n/a)
1010-latest@1.3.1 (tree)

Building a binary distribution

  • Install requirements (npm i)
  • npx node-pre-gyp rebuild package
  • With appropriate AWS credentials configured, npx node-pre-gyp publish

Or you can run the scripts

npm run binary:build
npm run binary:publish

Related Projects

Credit

This is based on the output of libpg_query. This wraps the static library output and links it into a node module for use in js.

All credit for the hard problems goes to Lukas Fittl.

Additional thanks for node binding Ethan Resnick.

Original Code and License

16.2.2

8 months ago

16.3.0

8 months ago

15.2.0

1 year ago

15.1.2

1 year ago

15.2.0-rc.deparse.3

12 months ago

15.1.3

1 year ago

15.1.1-rc.4

1 year ago

15.2.0-rc.deparse.2

12 months ago

15.2.0-deparse-v2

12 months ago

15.2.0-deparse

12 months ago

15.1.0

1 year ago

16.1.0-rc.1

1 year ago

16.2.0

1 year ago

16.1.0

1 year ago

15.0.3

1 year ago

13.3.2

1 year ago

14.0.1

1 year ago

15.0.3-wasm.0.1

1 year ago

16.0.1

1 year ago

16.0.0

1 year ago

15.0.2

2 years ago

15.0.0

2 years ago

15.0.1

2 years ago

13.3.1

2 years ago

14.0.0

2 years ago

13.3.0

3 years ago

13.2.4-rc2

3 years ago

13.2.4-rc1

3 years ago

13.2.4-rc0

3 years ago

13.2.4

3 years ago

13.2.5

3 years ago

13.2.2

3 years ago

13.2.3

3 years ago

13.2.1

3 years ago

13.2.0

3 years ago

13.1.2

4 years ago

13.1.1

4 years ago

13.1.0

4 years ago

13.0.1

4 years ago

13.0.0

4 years ago