mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-07 17:04:59 +00:00
pretty print improvements (#1851)
This commit is contained in:
parent
3c59950060
commit
ae587dcbec
6 changed files with 334 additions and 69 deletions
|
@ -89,10 +89,14 @@ keywords, the following should hold true for all SQL:
|
|||
|
||||
```rust
|
||||
// Parse SQL
|
||||
let sql = "SELECT 'hello'";
|
||||
let ast = Parser::parse_sql(&GenericDialect, sql).unwrap();
|
||||
|
||||
// The original SQL text can be generated from the AST
|
||||
assert_eq!(ast[0].to_string(), sql);
|
||||
|
||||
// The SQL can also be pretty-printed with newlines and indentation
|
||||
assert_eq!(format!("{:#}", ast[0]), "SELECT\n 'hello'");
|
||||
```
|
||||
|
||||
There are still some cases in this crate where different SQL with seemingly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue