Skip to content

delaurentis/node-pg-query-native

 
 

Repository files navigation

pg-query-native Build Status

The real PostgreSQL parser for nodejs.

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.

Installation

npm install pg-query-native

Documentation

query.parse(query)

Parses the query and returns the parse tree.

Parameters

parameter type description
query String SQL query

Returns an object in the format:

{ query: <query|Object>,
  error: { message: <message|String>,
           fileName: <fileName|String>,
           lineNumber: <line|Number>,
           cursorPosition: <cursor|Number> }

Example

var parse = require('pg-query-native').parse;

console.log(parse('select 1').query);

Related

About

Fork to fix some security vulnerabilities in: PostgreSQL Query Parser for Node.js. Have since reached out to project maintainer, and they have been fixed.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 43.5%
  • C 25.5%
  • JavaScript 22.3%
  • Python 8.7%