Skip to main content

Module formatter

Module formatter 

Source
Expand description

Basic SQL formatting — round-trips through sqlparser’s AST and emits its Display. See format() as the entry point.

Output is a pass-through to sqlparser::ast::Statement’s Display impl (keywords uppercase, single-space separators, comments dropped). Default is single-line; opt into sqlparser’s multi-line pretty-print by setting FormatterOptions::pretty and using format_with_options.

For value-normalization (collapsing 1 and 42 into the same literal, etc.) see crate::normalizer.

Structs§

Formatter
Struct-style entry point. Used by both format() and format_with_options().
FormatterOptions
Options controlling format_with_options() / Formatter::format.

Functions§

format
Parse sql under dialect and re-emit one formatted string per statement.
format_with_options
Parse sql under dialect and re-emit one formatted string per statement, with formatting controlled by options.