pg_query.rs   ![Build Status] ![Latest Version] ![Docs Badge]

PostgreSQL parser for Rust that uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.

Warning! This library is in early stages of development so any APIs exposed are subject to change.

Getting started

Add the following to your Cargo.toml

toml [dependencies] pg_query = "0.4"

Example: Parsing a query

```rust use pg_query::ast::Node;

let result = pgquery::parse("SELECT * FROM contacts"); assert!(result.isok()); let result = result.unwrap(); assert!(matches!(*&result[0], Node::SelectStmt(_))); ```

Credits

A huge thank you to Lukas Fittl for all of his amazing work creating libpg_query.