go/database

Standardize Go MySQL data access with sqlx connection pools and transactions.

3|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/deandum/claude-resources --skill go-database-deandum
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: go/database
Source: https://github.com/deandum/claude-resources/tree/main/skills/go/database
Command: npx skills add https://github.com/deandum/claude-resources --skill go-database-deandum

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

MySQL database patterns with sqlx. Connection pooling, query patterns, transactions, repository pattern, error handling. 100% Go-specific.

Core Features & Use Cases

  • sqlx-based patterns for Go to simplify database access with context-aware operations and typed mappings.
  • Transaction management with proper rollback semantics and error handling.
  • Repository pattern enabling testability and separation of concerns, with examples for typical MySQL workloads.

Quick Start

Create a Go project, connect to MySQL using sqlx, and implement a repository for a sample entity.

Frequently Asked Questions about go/database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement the repository pattern in Go with sqlx for MySQL?▼

To implement the repository pattern with sqlx, structure your Go code to separate data access logic from business logic using context-aware queries and typed struct mappings. This ensures testable code and clear separation of concerns across services.

How do you handle MySQL transactions and rollbacks in Go using sqlx?▼

MySQL transactions in Go using sqlx require explicit transaction handling with proper rollback semantics. If a query fails, the transaction is rolled back to maintain database consistency and ensure robust error handling.

What is the best way to configure a safe MySQL connection pool in a Go application?▼

Configuring a safe MySQL connection pool in Go involves setting up sqlx with context-aware operations. This ensures queries respect deadlines and cancellations, maintaining robust and safe database access across concurrent services.

How do I map MySQL errors to specific application errors in a Go sqlx repository?▼

MySQL error mapping in a Go sqlx repository translates database-specific errors into application-level errors. This ensures robust error handling by standardizing how data access failures are propagated and managed across your services.

Does this sqlx database pattern support context-aware queries for concurrent Go services?▼

Yes, the sqlx database pattern implements context variants for all queries, making it fully suitable for concurrent Go services. Context-aware operations ensure that database calls respect request deadlines and cancellations safely.