Skip to content

Emscripten Port of pg_query to easily play with it in the browser

License

Notifications You must be signed in to change notification settings

EliSnow/pg-query-emscripten

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg-query-emscripten

Parse any valid PostgreSQL query in your browser using Javascript!

This builds a pure Javascript port of libpg_query using emscripten, that allows you to parse SQL in the browser into the PostgreSQL parse tree.

Example use cases might include automatically checking for bad query patterns (e.g. LIMIT/OFFSET), understanding which tables a query references, or using structural pg_dump output to produce a schema diagram on the fly.

Usage (Plain JS)

<script src="https://unpkg.com/pg-query-emscripten"></script>
<script>
  console.log(PgQuery.parse("SELECT 1"));
</script>

Usage (npm)

npm install pg-query-emscripten --save

Then import using your favorite tool, e.g.

import PgQuery from 'pg-query-emscripten';

console.log(PgQuery.parse("SELECT 1"));

Author

LICENSE

Copyright (c) 2016 Lukas Fittl
Licensed under the MIT License.

About

Emscripten Port of pg_query to easily play with it in the browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 46.8%
  • Makefile 42.3%
  • JavaScript 10.9%