Enables parsing, formatting, validation, and analysis of MySQL SQL queries, providing tools for linting, metadata extraction, and identifying potential security vulnerabilities.
Enables parsing, formatting, validation, and analysis of PostgreSQL SQL queries, providing tools for linting, metadata extraction, and identifying potential security vulnerabilities.
Enables parsing, formatting, validation, and analysis of Snowflake SQL queries, providing tools for linting, metadata extraction, and identifying potential security vulnerabilities.
Enables parsing, formatting, validation, and analysis of SQLite SQL queries, providing tools for linting, metadata extraction, and identifying potential security vulnerabilities.
GoSQLX
Parse SQL at the speed of Go
🌐 Try the Playground · 📖 Read the Docs · 🚀 Get Started · 📊 Benchmarks
1.25M+ ops/sec | <1μs latency | 85% SQL-99 | 6 dialects | 0 race conditions |
What is GoSQLX?
GoSQLX is a production-ready SQL parsing SDK for Go. It tokenizes, parses, and generates ASTs from SQL with zero-copy optimizations and intelligent object pooling - handling 1.25M+ operations per second with sub-microsecond latency.
ast, _ := gosqlx.Parse("SELECT u.name, COUNT(*) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.name")
// → Full AST with statements, columns, joins, grouping - ready for analysis, transformation, or formattingWhy GoSQLX?
Not an ORM - a parser. You get the AST, you decide what to do with it.
Not slow - zero-copy tokenization, sync.Pool recycling, no allocations on hot paths.
Not limited - PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake. CTEs, window functions, MERGE, set operations.
Not just a library - CLI, VS Code extension, GitHub Action, MCP server, WASM playground, Python bindings.
Get Started in 60 Seconds
go get github.com/ajitpratap0/GoSQLXpackage main
import (
"fmt"
"github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
)
func main() {
// Parse any SQL dialect
ast, _ := gosqlx.Parse("SELECT * FROM users WHERE active = true")
fmt.Printf("%d statement(s)\n", len(ast.Statements))
// Format messy SQL
clean, _ := gosqlx.Format("select id,name from users where id=1", gosqlx.DefaultFormatOptions())
fmt.Println(clean)
// SELECT
// id,
// name
// FROM users
// WHERE id = 1
// Catch errors before production
if err := gosqlx.Validate("SELECT * FROM"); err != nil {
fmt.Println(err) // → expected table name
}
}Install Everywhere
📦 Go Library
go get github.com/ajitpratap0/GoSQLX🖥️ CLI Tool
go install github.com/ajitpratap0/GoSQLX/cmd/gosqlx@latest
gosqlx validate "SELECT * FROM users"
gosqlx format query.sql
gosqlx lint query.sql💻 VS Code Extension
code --install-extension ajitpratap0.gosqlxBundles the binary - zero setup. Learn more →
🤖 MCP Server (AI Integration)
claude mcp add --transport http gosqlx \
https://mcp.gosqlx.dev/mcp7 SQL tools in Claude, Cursor, or any MCP client. Guide →
Features at a Glance
Documentation
Resource | Description | |
🌐 | Website with interactive playground | |
🚀 | Parse your first SQL in 5 minutes | |
📖 | Comprehensive patterns and examples | |
📄 | Complete API documentation | |
🖥️ | Command-line tool reference | |
🌍 | Dialect support matrix | |
🤖 | AI assistant integration | |
🏗️ | System design deep-dive | |
📊 | Performance data and methodology | |
📝 | What's new in each version |
Contributing
GoSQLX is built by contributors like you. Whether it's a bug fix, new feature, documentation improvement, or just a typo - every contribution matters.
git clone https://github.com/ajitpratap0/GoSQLX.git && cd GoSQLX
task check # fmt → vet → lint → test (with race detection)Fork & branch from
mainWrite tests - we use TDD and require race-free code
Run - must pass before PR
Open a PR - we review within 24 hours
📋 Contributing Guide · 📜 Code of Conduct · 🏛️ Governance
Community
Got questions? Ideas? Found a bug?
License
Apache License 2.0 - see LICENSE for details.
Built with ❤️ by the GoSQLX community
gosqlx.dev · Playground · Docs · MCP Server · VS Code
If GoSQLX helps your project, consider giving it a ⭐