A naive Go library that provides SQL formatting capabilities by using the sql-formatter JavaScript library through go-quickjs.
To use sqlfmt
in your Go project, you can simply import it:
import "github.com/0x6b/sqlfmt"
Then, run go mod tidy
to download the dependencies.
The sqlfmt
package exposes a FormatSQL
function and a DefaultFormatOptions
variable. You can use DefaultFormatOptions
and override specific fields as needed. See example for usage.
The assets
directory contains sql-formatter.min.js
(version 15.6.6), which is an artifact from the sql-formatter project.
MIT. See LICENSE for details.