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
- Host: GitHub
- URL: https://github.com/moedevelops/squeal
- Owner: MoeDevelops
- License: mit
- Created: 2024-10-21T13:00:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-24T12:45:07.000Z (over 1 year ago)
- Last Synced: 2025-03-14T23:37:52.361Z (over 1 year ago)
- Language: Gleam
- Size: 85 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗣️ Squeal
[](https://hex.pm/packages/squeal)
[](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
```