What problem does it solve?
Go projects often struggle with inconsistent data access patterns when using GORM with SQLite. This skill provides a standardized approach to structuring entities with GORM tags, configuring the SQLite driver, implementing a repository layer, and using hooks like BeforeCreate to prepare IDs or hash data before persistence.
Core Features & Use Cases
- Entity Modeling: Map domain entities to database tables using GORM with field tags for primary keys and types.
- SQLite Integration: Leverage the sqlite driver via gorm.io/driver/sqlite for local and lightweight storage.
- Repository Pattern: Centralize CRUD operations in the repository layer to avoid leaking gorm.DB references into use cases or handlers.
- Lifecycle Hooks: Use BeforeCreate hooks to generate IDs or hash sensitive data before insertion.
Quick Start
Configure your Go project to use GORM with SQLite by defining entities with GORM tags, wiring the SQLite driver, and implementing a repository layer with BeforeCreate hooks for IDs.