pub fn format_with_options(
dialect: &dyn Dialect,
sql: &str,
options: FormatterOptions,
) -> Result<Vec<String>, Error>Expand description
Parse sql under dialect and re-emit one formatted string per
statement, with formatting controlled by options.
ยงExample
use sql_insight::sqlparser::dialect::GenericDialect;
use sql_insight::formatter::{format_with_options, FormatterOptions};
let dialect = GenericDialect {};
let sql = "SELECT a, b FROM t1";
let result = format_with_options(
&dialect,
sql,
FormatterOptions::new().with_pretty(true),
)
.unwrap();
assert_eq!(result[0], "SELECT\n a,\n b\nFROM\n t1");