package pg_query
Bindings to libpg_query for parsing PostgreSQL
Install
Dune Dependency
Authors
Maintainers
Sources
0.9.7.tar.gz
md5=0f60f8c91c556be3f3a7e8f3f8305bb2
sha512=0efa2224ef75f1cea12437673da677964de0d56616e2166e2a794d6f6fd431b44dade1e18455cfeeab12576265f189030df4cd614f764970113476fc036633d2
Description
OCaml bindings to libpg_query for parsing PostgreSQL, and a command-line tool that uses them
Published: 12 May 2021
README
pg_query-ocaml
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"
Dependencies (6)
-
ppx_deriving
>= "4.2"
- ctypes-foreign
-
ctypes
>= "0.14.0"
-
cmdliner
>= "1.0.0"
-
dune
>= "2.0"
-
ocaml
>= "4.07"
Dev Dependencies (1)
-
alcotest
with-test
Used by (1)
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page