1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! pg_parse
//! ============
//!
//! PostgreSQL parser that uses the [actual PostgreSQL server source]((https://github.com/pganalyze/libpg_query)) 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_parse = "0.9"
//! ```
//!
//! # Example: Parsing a query
//!
//! ```rust
//! use pg_parse::ast::Node;
//!
//! let result = pg_parse::parse("SELECT * FROM contacts");
//! assert!(result.is_ok());
//! let result = result.unwrap();
//! assert!(matches!(*&result[0], Node::SelectStmt(_)));
//!
//! // We can also convert back to a string, if the `str` feature is enabled (enabled by default).
//! #[cfg(feature = "str")]
//! assert_eq!(result[0].to_string(), "SELECT * FROM contacts");
//! ```
//!
/// Generated structures representing the PostgreSQL AST.
pub use *;
pub use *;