Function pg_query::parse[][src]

pub fn parse(stmt: &str) -> Result<Vec<Node>>

Parses the given SQL statement into the given abstract syntax tree.

Example

use pg_query::ast::Node;

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