sqlex
OfficialEnhance Go database operations with sqlex
Authorgo-sqlex
Version1.0.0
Installs0
System Documentation
What problem does it solve?
sqlex simplifies Go database operations, providing advanced features like structured JSON types, Hook aspects for logging and metrics, and automatic rebind for easier SQL injection prevention.
Core Features & Use Cases
- Advanced JSON Handling: Generic JSONValue[T] for auto-serialize/deserialize JSON columns.
- Hook System: Pluggable SQL interceptors for logging, tracing, and metrics.
- Automatic Rebind: Writes ? uniformly across all databases for easier SQL injection prevention.
- Use Case: With sqlex, you can write code like
db.Get(&user, "SELECT * FROM users WHERE id = ?", 1)which will work across PostgreSQL, MySQL, SQLite, and SQL Server without needing to change the query syntax.
Quick Start
Use sqlex to connect to your database and execute queries:
db, err := sqlex.Connect("sqlite3", ":memory:")
if err != nil {
log.Fatal(err)
}
defer db.Close()
// Insert a user
_, err = db.Exec("INSERT INTO users (name, email) VALUES (?, ?)", "Alice", "[email protected]")
if err != nil {
log.Fatal(err)
}
// Query a user
var user User
err = db.Get(&user, "SELECT * FROM users WHERE id = ?", 1)
if err != nil {
log.Fatal(err)
}
fmt.Printf("User: %+v\n", user)
Dependency Matrix
Required Modules
github.com/go-sqlex/sqlex
Components
scriptsreferences
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: sqlex Download link: https://github.com/go-sqlex/sqlex/archive/main.zip#sqlex Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 620,000+ vetted skills library on demand.