Selecto.SQL.Formatter (Selecto v0.3.16)

Lightweight SQL formatting and highlighting helpers.

This module is intentionally conservative: it improves readability for generated Selecto SQL without attempting to be a full SQL parser.

Link to this section Summary

Functions

Format SQL for readability.

Apply lightweight SQL highlighting.

Link to this section Functions

Link to this function

format(sql, opts \\ [])

@spec format(
  String.t(),
  keyword()
) :: String.t()

Format SQL for readability.

Options:

  • :indent string used for indentation (default: two spaces)
  • :where_multiline boolean to split AND/OR conditions across lines (default: true)
Link to this function

highlight(sql, arg2)

@spec highlight(String.t(), :ansi | :markdown | nil) :: String.t()

Apply lightweight SQL highlighting.

Supported styles:

  • :ansi - terminal ANSI colors
  • :markdown - markdown emphasis for keywords