golang-database

Guide Go developers on secure SQL database code with transactions and connection pooling.

Updated May 4, 2026
One-click install
npx skills add https://github.com/VIethoangnguyenle/nexus-enterprise --skill golang-database-viethoangnguyenle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-database
Source: https://github.com/VIethoangnguyenle/nexus-enterprise/tree/main/.agent/skills/golang-database
Command: npx skills add https://github.com/VIethoangnguyenle/nexus-enterprise --skill golang-database-viethoangnguyenle

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill helps developers write clean, reliable, and maintainable Go code for database access, preventing common pitfalls and inefficiencies.

Core Features & Use Cases

  • Best Practice Guidance: Provides guidelines for parameterized queries, proper error handling, and transaction management.
  • Code Examples: Demonstrates struct scanning, handling NULLable columns, and connection pool configuration.
  • Use Case: Use this Skill when developing a Go backend that needs safe, performant database operations with PostgreSQL, MySQL, or SQLite.

Quick Start

Use the golang-database skill to improve your database code safety and performance.

Frequently Asked Questions about golang-database

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

FAQPage Schema
How do I handle SQL transactions and connection pooling in Go?

To manage SQL transactions and connection pooling in Go, configure the database connection pool settings and wrap operations in transaction blocks. This ensures robust connection reuse and safe, atomic database state changes.

What is the best way to handle NULL values when scanning database rows in Golang?

Handling NULL values in Golang requires using nullable types like sql.NullString or pointers during struct scanning. This prevents scan errors and safely represents missing database columns in Go structs.

How do I prevent SQL injection in Go database queries?

Prevent SQL injection in Go database queries by using parameterized queries with placeholders instead of string concatenation. This ensures the database safely separates code from user-supplied data.

Does this Go database guidance work with PostgreSQL, MySQL, and SQLite?

Yes, this Go database guidance applies to PostgreSQL, MySQL, and SQLite. It provides best practices for safe, performant database operations across these SQL database systems.

How do I manage error handling for database operations in Golang?

Error handling for database operations in Golang involves checking errors immediately after query execution and transaction commits. This detects failures early and ensures reliable database interactions.