feat: add sqlparser

This commit is contained in:
2021-01-11 23:48:12 +08:00
parent 9c33fca074
commit a52e5192f0
3 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
fn main() {
let sql = "SELECT a, b, 123, myfunc(b) \
FROM table_1 \
WHERE a > b AND b < 100 \
ORDER BY a DESC, b";
let dialect = GenericDialect {}; // or AnsiDialect, or your own dialect ...
let ast = Parser::parse_sql(&dialect, sql).unwrap();
println!("AST: {:#?}", ast);
}