🗣️ Squeal

Package Version Hex Docs

Gleam SQL-Formatter using the js package sql-formatter

Squeal formats all *.sql files in your current directory and subdirectories

gleam add --dev squeal@1
gleam run -m squeal
gleam run -m squeal -- --width=4 --identifiercase=lower

Flags

--datatypecase=preserve|upper|lower
--denseoperators=<BOOL>
--dialect=sql|postgres|sqlite|mysql|mariasql
--expressionwidth=<INT>
--functioncase=preserve|upper|lower
--identifiercase=preserve|upper|lower
--indentstyle=standard|tableft|tabright
--keywordcase=preserve|upper|lower
--linesbetween=<INT>
--logicalopnewline=<BOOL>
--newlinesemi=<BOOL>
--tabs=<BOOL>
--width=<INT>

Parameters

If you use parameters like

select name from users where id = $1

you need to configure the sql dialect

gleam run -m squeal -- --dialect=postgres

Example

SQL-File:

select * FROM users

Command:

gleam run -m squeal -- --width=4 --identifiercase=lower

SQL-File:

SELECT
    *
FROM
    users

Command:

gleam run -m squeal -- --width=2 --identifiercase=lower --keywordcase=lower

SQL-File:

select
  *
from
  users
Search Document