This library provides an Elixir wrapper around the Rust sqlformat library. This allows you to efficiently format and pretty print SQL queries.
Summary
Functions
This function takes a query as a string along with optional formatting settings and returns the formatted query.
This function takes a query as a string along with its parameters as a list of strings
and optional formatting settings and returns the formatted query. As a note, when using this
function all of the element in query_params must be strings and they all must be
extrapolated out to their appropriate SQL values. For example query params of ["my_id"]
should be ["'my_id'"] so that it is valid SQL when the parameter substitution takes place.
Functions
This function takes a query as a string along with optional formatting settings and returns the formatted query.
For formatting settings look at the SqlFmt.FormatOptions module docs.
@spec format_query_with_params( query :: String.t(), query_params :: [String.t()], fmt_opts :: keyword() ) :: {:ok, String.t()}
This function takes a query as a string along with its parameters as a list of strings
and optional formatting settings and returns the formatted query. As a note, when using this
function all of the element in query_params must be strings and they all must be
extrapolated out to their appropriate SQL values. For example query params of ["my_id"]
should be ["'my_id'"] so that it is valid SQL when the parameter substitution takes place.
For formatting settings look at the SqlFmt.FormatOptions module docs.