pub fn parse(statement: &str) -> Result<ParseResult>
Expand description
Parses the given SQL statement into the given abstract syntax tree.
Example
use pg_query::{Node, NodeEnum, NodeRef};
let result = pg_query::parse("SELECT * FROM contacts");
assert!(result.is_ok());
let result = result.unwrap();
assert_eq!(result.tables(), vec!["contacts"]);
assert!(matches!(result.protobuf.nodes()[0].0, NodeRef::SelectStmt(_)));