golang-database

Guide Go database interactions with parameterized queries and transaction management.

23|1|Updated May 10, 2026
One-click install
npx skills add https://github.com/berksunduri/GOPost --skill golang-database-berksunduri
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-database
Source: https://github.com/berksunduri/GOPost/tree/main/.agents/skills/golang-database
Command: npx skills add https://github.com/berksunduri/GOPost --skill golang-database-berksunduri

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires database/sql, sqlx, pgx, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidance on writing safe, explicit, and observable database code in Go, focusing on best practices, tools, and common pitfalls to avoid.

Core Features & Use Cases

  • Database Access: Comprehensive guide for parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, and connection pool management.
  • Use Case: For Go backend engineers working with PostgreSQL, MariaDB, MySQL, or SQLite, who need to write, review, or debug database interactions.

Quick Start

Run the 'golang-database' skill to access the complete guide on Go database best practices.

Frequently Asked Questions about golang-database

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

FAQPage Schema
How do I handle NULLable columns when scanning rows into structs in Go?

To handle NULLable columns in Go, use specific types like sql.NullString or pointers in your structs during row scanning. This Skill provides best practices for safely mapping database rows to structs while avoiding nil pointer dereferences.

What's the best way to manage database transactions and isolation levels in Go?

Manage database transactions in Go by using explicit Begin, Commit, and Rollback methods with configured isolation levels. This Skill provides best practices for writing safe, explicit, and observable transaction management code.

Should I use sqlx or pgx for Go database access with PostgreSQL?

Choosing between sqlx and pgx for Go database access depends on your need for standard library compatibility versus PostgreSQL-specific optimizations. This Skill offers tool recommendations and best practices applicable to both packages for safe database interactions.

How do I configure connection pool management for database/sql in Go?

Configure connection pool management in Go by tuning database/sql settings like SetMaxOpenConns, SetMaxIdleConns, and SetConnMaxLifetime. This Skill provides comprehensive guidance on optimizing connection pools for efficient database access.

Does this Go database guide apply to MySQL and SQLite or only PostgreSQL?

This Go database guide applies to PostgreSQL, MariaDB, MySQL, and SQLite. It provides comprehensive best practices for parameterized queries, struct scanning, and transaction management that are safe and efficient across these database systems.