MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / FormatSQL

Function FormatSQL

pkg/transform/transform.go:227–229  ·  view source on GitHub ↗

FormatSQL converts an AST statement back into a compact SQL string using the GoSQLX formatter. It is the inverse of ParseSQL and completes the parse-transform-format round-trip. The output uses compact style with minimal whitespace. Use this after applying transforms to obtain the final SQL to exec

(stmt ast.Statement)

Source from the content-addressed store, hash-verified

225// sql := transform.FormatSQL(stmt)
226// // "SELECT id, name FROM users WHERE active = true LIMIT 10"
227func FormatSQL(stmt ast.Statement) string {
228 return formatter.FormatStatement(stmt, ast.CompactStyle())
229}
230
231// FormatSQLWithDialect converts an AST statement back into a compact SQL string
232// using dialect-specific syntax for row-limiting clauses (TOP for SQL Server,

Callers 2

mainFunction · 0.92
formatFunction · 0.85

Calls 2

FormatStatementFunction · 0.92
CompactStyleFunction · 0.92

Tested by 1

formatFunction · 0.68