What problem does it solve?
Go applications frequently wrestle with verbose database access code and inconsistent handling of reads and writes. This Skill provides a comprehensive guide to using cool-mysql to simplify data access, enforce safe parameter usage, and implement robust caching, templating, and transactions.
Core Features & Use Cases
- Dual connection pools: separate read and write pools for optimized performance and correctness.
- Named parameters and templates: use @@param placeholders and Go templates for flexible, safe queries.
- Caching strategies: configure Redis, Memcached, or in-memory caches to reduce DB load on SELECTs.
- Automatic chunking and retries: handle large inserts and transient errors with minimal boilerplate.
- Strong typing and mapping: map results into structs, maps, slices, or JSON with minimal code.
- Transactional patterns: guidance for GetOrCreateTxFromContext, context management, and transactional work flows.
Quick Start
Install and import the library, then use the quick-start examples to connect and run basic queries. The Quick Start section in the repository demonstrates minimal code to create a dual-pool DB, perform a SELECT, and handle caching.