squeal/sql_formatter

Types

pub type Casing {
  Preserve
  Uppercase
  Lowercase
}

Constructors

  • Preserve
  • Uppercase
  • Lowercase
pub type Dialect {
  Sql
  Postgresql
  Sqlite
  MySql
  MariaSql
}

Constructors

  • Sql
  • Postgresql
  • Sqlite
  • MySql
  • MariaSql
pub type FormatOptions {
  FormatOptions(
    tab_width: Int,
    use_tabs: Bool,
    keyword_case: Casing,
    identifier_case: Casing,
    data_type_case: Casing,
    function_case: Casing,
    indent_style: IndentStyle,
    logical_operator_new_line_before: Bool,
    expression_width: Int,
    lines_between_queries: Int,
    dense_operators: Bool,
    newline_before_semicolon: Bool,
    dialect: Dialect,
  )
}

Constructors

  • FormatOptions(
      tab_width: Int,
      use_tabs: Bool,
      keyword_case: Casing,
      identifier_case: Casing,
      data_type_case: Casing,
      function_case: Casing,
      indent_style: IndentStyle,
      logical_operator_new_line_before: Bool,
      expression_width: Int,
      lines_between_queries: Int,
      dense_operators: Bool,
      newline_before_semicolon: Bool,
      dialect: Dialect,
    )
pub type IndentStyle {
  Standard
  TabularLeft
  TabularRight
}

Constructors

  • Standard
  • TabularLeft
  • TabularRight

Constants

pub const default_options: FormatOptions

Functions

pub fn casing_from_string(string: String) -> Result(Casing, Nil)
pub fn casing_to_string(casing: Casing) -> String
pub fn dialect_from_string(
  string: String,
) -> Result(Dialect, Nil)
pub fn dialect_to_string(dialect: Dialect) -> String
pub fn format(
  sql: String,
  options: FormatOptions,
) -> Result(String, String)
pub fn indent_style_from_string(
  string: String,
) -> Result(IndentStyle, Nil)
pub fn indent_style_to_string(style: IndentStyle) -> String
Search Document