Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

mibk.dev/sqlfmt

Package Overview
Dependencies
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mibk.dev/sqlfmt

Go Modules
Version
v0.2.1
Version published
Created
Source

sqlfmt

An opinionated SQL formatter.

Installation

go install mibk.dev/sqlfmt@latest

Usage

sqlfmt [-w] [-s] [path ...]

Without arguments, sqlfmt reads from stdin and writes the formatted output to stdout. When given file or directory paths, it processes them and prints the result. With directories, it recursively formats all .sql files.

Flags:

  • -w — write result to the source file instead of stdout
  • -s — simplify code

Example

Before:

SELECT
p . id , DATE_FORMAT ( p.date ,'%Y-%m-%d' ) AS datestr
FROM purchase p
JOIN building b ON p.station_id=b.id
WHERE p.user_id IN (
select user_id From registry
Where registered <= curdate()
)
   ORDER BY p.date  ;

After:

SELECT
	p.id, DATE_FORMAT(p.date, '%Y-%m-%d') AS datestr
FROM purchase p
JOIN building b ON p.station_id = b.id
WHERE p.user_id IN (
	SELECT user_id
	FROM registry
	WHERE registered <= CURDATE()
)
ORDER BY p.date;

License

MIT

FAQs

Package last updated on 14 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts