pg_query

Bindings to libpg_query for parsing PostgreSQL
README

Bindings for pg_query for parsing PostgreSQL. Documentation is
here.

Usage

This provides a library that can be used in OCaml code like so:

let statement = "SELECT user, email FROM users WHERE id = 7"

let () =
  match Pg_query.parse statement with
  | Ok parse_tree -> use parse_tree
  | Error error_message -> use error_message

and a command-line utility:

$ echo "SELECT * FROM users" >> good.sql
$ echo "SELECT * FFROM users" >> bad.sql
$ pg_check good.sql bad.sql
[{"RawStmt": {"stmt": {"SelectStmt": {"targetList": [{"ResTarget": {"val": {"ColumnRef": {"fields": [{"A_Star": {}}], "location": 7}}, "location": 7}}], "fromClause": [{"RangeVar": {"relname": "users", "inh": true, "relpersistence": "p", "location": 14}}], "op": 0}}}}]
syntax error at or near "FFROM"
Install
Published
28 Jul 2020
Sources
0.9.5.tar.gz
md5=26278704b2df581a305c91ad9f596d2e
sha512=d509459e17402b32a1e92de7b63c592e0a1d42273d7ea0223b5b2f06e3f2b319d909beedffe71a12b58630bf4c877f8ca58af42684fab246ca9ab5cee3fc78ef
Dependencies
ctypes
>= "0.14.0"
core
< "v0.15"
dune
>= "2.0"
ocaml
>= "4.07"
Reverse Dependencies
ppx_rapper
< "3.1.0"