An open API service indexing awesome lists of open source software.

https://github.com/moedevelops/squeal

🗣️ SQL Formatter for Gleam
https://github.com/moedevelops/squeal

Last synced: 6 months ago
JSON representation

🗣️ SQL Formatter for Gleam

Awesome Lists containing this project

README

          

# 🗣️ Squeal

[![Package Version](https://img.shields.io/hexpm/v/squeal)](https://hex.pm/packages/squeal)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/squeal/)

## Gleam SQL-Formatter using the js package [sql-formatter](https://github.com/sql-formatter-org/sql-formatter)

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

```sh
gleam add --dev squeal@1
gleam run -m squeal
gleam run -m squeal -- --width=4 --identifiercase=lower --exclude=sql/do_not_format.sql
```

## Flags

```string
--exclude=
--datatypecase=preserve|upper|lower
--denseoperators=
--dialect=sql|postgres|sqlite|mysql|mariasql
--expressionwidth=
--functioncase=preserve|upper|lower
--identifiercase=preserve|upper|lower
--indentstyle=standard|tableft|tabright
--keywordcase=preserve|upper|lower
--linesbetween=
--logicalopnewline=
--newlinesemi=
--tabs=
--width=
```

## Parameters

If you use parameters like

```sql
select name from users where id = $1
```

you need to configure the sql dialect

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

## Example

SQL-File:

```sql
select * FROM users
```

Command:

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

SQL-File:

```sql
SELECT
*
FROM
users
```

Command:

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

SQL-File:

```sql
select
*
from
users
```