Production-ready SQL parsing SDK for Go with 7 SQL tools
GoSQLX
Parse SQL at the speed of Go
๐ Try the Playground ยท ๐ Read the Docs ยท ๐ Get Started ยท ๐ Benchmarks
| 1.38M+ ops/sec | <1ฮผs latency | 85% SQL-99 | 7 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.38M+ 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 formatting
Why 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, ClickHouse. 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/GoSQLX
package 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
๐ฅ๏ธ CLI Tool
|
๐ป VS Code Extension
Bundles the binary - zero setup. Learn more โ ๐ค MCP Server (AI Integration)
7 SQL tools in Claude, Cursor, or any MCP client. Guide โ |
Features at a Glance
โก ParserZero-copy tokenizerRecursive descent parserFull AST generationTools (5)validateValidates SQL syntax for supported dialectsformatFormats SQL queries for readabilitylintAnalyzes SQL for best practices and potential issuessecurity_scanScans SQL for potential security vulnerabilitiesparseParses SQL into a structured ASTConfigurationclaude_desktop_config.json {"mcpServers": {"gosqlx": {"command": "curl", "args": ["https://mcp.gosqlx.dev/mcp"]}}}Try itโValidate this SQL query for PostgreSQL syntax: SELECT * FROM users WHERE id = 1 โFormat the following messy SQL query to make it readable: select id,name from users where id=1 โPerform a security scan on this SQL query to check for potential injection risks: SELECT * FROM users WHERE name = '$USER_INPUT' โParse this SQL statement and return the AST structure: SELECT u.name, COUNT(*) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.name Frequently Asked QuestionsWhat are the key features of GoSQLX?Zero-copy SQL tokenization and parsing. Support for 7 SQL dialects including PostgreSQL, MySQL, and SQLite. Full AST generation for complex SQL analysis. Built-in SQL validation, formatting, and linting. High-performance architecture handling 1.38M+ ops/sec. What can I use GoSQLX for?Automating SQL code review and linting in development workflows. Standardizing SQL formatting across large codebases. Detecting potential SQL injection vulnerabilities during development. Building AI-powered SQL query builders and analyzers. How do I install GoSQLX? Install GoSQLX by running: What MCP clients work with GoSQLX?GoSQLX works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support. Turn this server into reusable contextKeep GoSQLX docs, env vars, and workflow notes in Conare so your agent carries them across sessions. Need the old visual installer? Open Conare IDE. |