An open API service indexing awesome lists of open source software.

https://github.com/ajitpratap0/GoSQLX

High-performance SQL parser, formatter, linter & security scanner for Go โ€” 1.5M+ ops/sec, multi-dialect, zero-copy, race-free
https://github.com/ajitpratap0/GoSQLX

ast cli dialect go golang lsp mysql parser postgresql query-analyzer security sql sql-formatter sql-injection sql-linter sql-parser sql-validator sqlite wasm zero-copy

Last synced: 10 days ago
JSON representation

High-performance SQL parser, formatter, linter & security scanner for Go โ€” 1.5M+ ops/sec, multi-dialect, zero-copy, race-free

Awesome Lists containing this project

README

          

# GoSQLX

GoSQLX Logo

### Parse SQL at the speed of Go

[![Go Version](https://img.shields.io/badge/Go-1.25+-00ADD8?style=for-the-badge&logo=go)](https://go.dev)
[![Release](https://img.shields.io/github/v/release/ajitpratap0/GoSQLX?style=for-the-badge&color=orange)](https://github.com/ajitpratap0/GoSQLX/releases)
[![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg?style=for-the-badge)](LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com)

[![Website](https://img.shields.io/badge/gosqlx.dev-Website-blue?style=for-the-badge&logo=google-chrome)](https://gosqlx.dev)
[![VS Code](https://img.shields.io/visual-studio-marketplace/v/ajitpratap0.gosqlx?style=for-the-badge&logo=visual-studio-code&label=VS%20Code)](https://marketplace.visualstudio.com/items?itemName=ajitpratap0.gosqlx)
[![MCP](https://img.shields.io/badge/MCP-Remote%20Server-blue?style=for-the-badge&logo=cloud)](https://mcp.gosqlx.dev/health)
[![Glama MCP Server](https://glama.ai/mcp/servers/ajitpratap0/GoSQLX/badges/score.svg)](https://glama.ai/mcp/servers/ajitpratap0/GoSQLX)
[![Lint Action](https://img.shields.io/badge/Lint%20Action-GitHub-blue?style=for-the-badge&logo=github)](https://github.com/marketplace/actions/gosqlx-lint-action)

[![Tests](https://img.shields.io/github/actions/workflow/status/ajitpratap0/GoSQLX/test.yml?branch=main&label=Tests&style=flat-square)](https://github.com/ajitpratap0/GoSQLX/actions)
[![Go Report](https://goreportcard.com/badge/github.com/ajitpratap0/GoSQLX?style=flat-square)](https://goreportcard.com/report/github.com/ajitpratap0/GoSQLX)
[![GoDoc](https://pkg.go.dev/badge/github.com/ajitpratap0/GoSQLX?style=flat-square)](https://pkg.go.dev/github.com/ajitpratap0/GoSQLX)
[![Stars](https://img.shields.io/github/stars/ajitpratap0/GoSQLX?style=social)](https://github.com/ajitpratap0/GoSQLX)


**[๐ŸŒ Try the Playground](https://gosqlx.dev/playground/)** ย ยทย  **[๐Ÿ“– Read the Docs](https://gosqlx.dev/docs/)** ย ยทย  **[๐Ÿš€ Get Started](docs/GETTING_STARTED.md)** ย ยทย  **[๐Ÿ“Š Benchmarks](https://gosqlx.dev/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.

```go
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. 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

```bash
go get github.com/ajitpratap0/GoSQLX
```

```go
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
```bash
go get github.com/ajitpratap0/GoSQLX
```

### ๐Ÿ–ฅ๏ธ CLI Tool
```bash
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
```bash
code --install-extension ajitpratap0.gosqlx
```
Bundles the binary - zero setup. [Learn more โ†’](https://gosqlx.dev/vscode/)

### ๐Ÿค– MCP Server (AI Integration)
```bash
claude mcp add --transport http gosqlx \
https://mcp.gosqlx.dev/mcp
```
7 SQL tools in Claude, Cursor, or any MCP client. [Guide โ†’](https://gosqlx.dev/docs/mcp_guide/)


## Features at a Glance

โšก Parser

Zero-copy tokenizer
Recursive descent parser
Full AST generation
Multi-dialect engine

๐Ÿ›ก๏ธ Analysis

SQL injection scanner
10 lint rules (L001โ€“L010)
Query complexity scoring
Metadata extraction

๐Ÿ”ง Tooling

AST-based formatter
Query transforms API
VS Code extension
GitHub Action

๐ŸŒ Multi-Dialect

PostgreSQL ยท MySQL
SQL Server ยท Oracle
SQLite ยท Snowflake

๐Ÿค– AI-Ready

MCP server (7 tools)
Public remote endpoint
Streamable HTTP

๐Ÿงช Battle-Tested

20K+ concurrent ops
Zero race conditions
~85% SQL-99 compliance


## Documentation

| | Resource | Description |
|---|---|---|
| ๐ŸŒ | **[gosqlx.dev](https://gosqlx.dev)** | Website with interactive playground |
| ๐Ÿš€ | **[Getting Started](https://gosqlx.dev/docs/getting_started/)** | Parse your first SQL in 5 minutes |
| ๐Ÿ“– | **[Usage Guide](https://gosqlx.dev/docs/usage_guide/)** | Comprehensive patterns and examples |
| ๐Ÿ“„ | **[API Reference](https://gosqlx.dev/docs/api_reference/)** | Complete API documentation |
| ๐Ÿ–ฅ๏ธ | **[CLI Guide](https://gosqlx.dev/docs/cli_guide/)** | Command-line tool reference |
| ๐ŸŒ | **[SQL Compatibility](https://gosqlx.dev/docs/sql_compatibility/)** | Dialect support matrix |
| ๐Ÿค– | **[MCP Guide](https://gosqlx.dev/docs/mcp_guide/)** | AI assistant integration |
| ๐Ÿ—๏ธ | **[Architecture](https://gosqlx.dev/docs/architecture/)** | System design deep-dive |
| ๐Ÿ“Š | **[Benchmarks](https://gosqlx.dev/benchmarks/)** | Performance data and methodology |
| ๐Ÿ“ | **[Release Notes](https://gosqlx.dev/blog/)** | 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.

```bash
git clone https://github.com/ajitpratap0/GoSQLX.git && cd GoSQLX
task check # fmt โ†’ vet โ†’ lint โ†’ test (with race detection)
```

1. **Fork & branch** from `main`
2. **Write tests** - we use TDD and require race-free code
3. **Run `task check`** - must pass before PR
4. **Open a PR** - we review within 24 hours

๐Ÿ“‹ [Contributing Guide](CONTRIBUTING.md) ยท ๐Ÿ“œ [Code of Conduct](CODE_OF_CONDUCT.md) ยท ๐Ÿ›๏ธ [Governance](GOVERNANCE.md)


## Community

**Got questions? Ideas? Found a bug?**

Discussions
Issues
Blog


## License

Apache License 2.0 - see [LICENSE](LICENSE) for details.

---

Built with โค๏ธ by the GoSQLX community

**[gosqlx.dev](https://gosqlx.dev)** ยท **[Playground](https://gosqlx.dev/playground/)** ยท **[Docs](https://gosqlx.dev/docs/)** ยท **[MCP Server](https://mcp.gosqlx.dev/mcp)** ยท **[VS Code](https://marketplace.visualstudio.com/items?itemName=ajitpratap0.gosqlx)**


If GoSQLX helps your project, consider giving it a โญ