Giter Site home page Giter Site logo

aquariuslt / libpg-query-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from launchql/libpg-query-node

0.0 1.0 0.0 16.24 MB

libpg_query PG port for node.js

License: MIT License

Shell 6.03% JavaScript 22.81% C++ 48.28% Python 7.02% C 2.51% Dockerfile 0.62% Makefile 7.51% Batchfile 5.22%

libpg-query-node's Introduction

libpg-query

webincubator

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 Version libpg_query Branch npm
16 16-latest 16-latest [email protected]
15 15-latest 15-latest [email protected]
14 14-latest 14-latest [email protected]
13 13-latest 13-latest [email protected]
12 (n/a)
11 (n/a)
10 10-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

libpg-query-node's People

Contributors

pyramation avatar zhm avatar gregnr avatar ethanresnick avatar matus123 avatar darora avatar maschwenk avatar wale avatar benasher44 avatar inian avatar karlhorky avatar yosiat avatar aquariuslt avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.