Skip to content

Commit 6fd27d5

Browse files
committed
readme example for pretty printing
1 parent 5848906 commit 6fd27d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,14 @@ keywords, the following should hold true for all SQL:
8989

9090
```rust
9191
// Parse SQL
92+
let sql = "SELECT 'hello'";
9293
let ast = Parser::parse_sql(&GenericDialect, sql).unwrap();
9394

9495
// The original SQL text can be generated from the AST
9596
assert_eq!(ast[0].to_string(), sql);
97+
98+
// The SQL can also be pretty-printed with newlines and indentation
99+
assert_eq!(format!("{:#}", ast[0]), "SELECT\n 'hello'");
96100
```
97101

98102
There are still some cases in this crate where different SQL with seemingly

0 commit comments

Comments
 (0)