SqlFmt.FormatOptions (SqlFmt v0.5.0)

Copy Markdown View Source

These options are used to control how the SQL statement is formatted. The available formatting options are:

  • :indent – Specifies how many spaces are used for indents Defaults to 2.

  • :uppercase – Configures whether SQL reserved words are capitalized. Defaults to true.

  • :lines_between_queries – Specifies how many line breaks should be present after a query. Defaults to 1.

  • :ignore_case_convert – Configures whether certain strings should not be case converted. Defaults to [].

  • :dialect - Tells what dialect of SQL to use for formatting. Defaults to :postgres.

  • :inline - Directs the SQL formatter whether to keep the query within a single line. Defaults to false.

  • :joins_as_top_level - Consider any JOIN statement as a top level keyword instead of a reserved keyword. Defaults to false.

  • :max_inline_block - Maximum length of an inline block. Defaults to 50.

  • :max_inline_arguments - Maximum length of inline arguments. If nil then every argument will be placed on a separate line. Defaults to nil.

  • :max_inline_top_level - Inline the argument at the top level if they would fit a line of this length. Defaults to nil.

Summary

Types

t()

The available formatting options.

Functions

Create an instance of the FormatOptions struct.

Types

t()

@type t() :: %SqlFmt.FormatOptions{
  dialect: :generic | :postgres | :sql_server,
  ignore_case_convert: [String.t()],
  indent: non_neg_integer(),
  inline: boolean(),
  joins_as_top_level: boolean(),
  lines_between_queries: non_neg_integer(),
  max_inline_arguments: non_neg_integer() | nil,
  max_inline_block: non_neg_integer(),
  max_inline_top_level: non_neg_integer() | nil,
  uppercase: boolean()
}

The available formatting options.

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Create an instance of the FormatOptions struct.