gorm-dao

Installation
SKILL.md

GORM with the DAO Pattern

This skill guides writing Go data access layers using GORM (gorm.io) organized around the DAO pattern. All database operations go through a single DAO struct, with methods grouped into per-entity files. This keeps callers free from direct database concerns while keeping each file focused.

When to read reference files

This skill includes detailed GORM reference docs in references/. Read them when you need specifics:

  • references/gorm-basics.md -- Models, struct tags, conventions, CRUD operations, connecting to databases. Read when defining new models or writing basic queries.
  • references/gorm-associations.md -- Belongs-to, has-one, has-many, many-to-many, preloading, association mode. Read when defining relationships between models or loading related data.
  • references/gorm-advanced.md -- Scopes, transactions, hooks, migrations, performance tuning, error handling, raw SQL, custom data types. Read when writing complex queries, transactions, or optimizing performance.
  • references/sqlite-wasm.md -- The ncruces/go-sqlite3 pure-WASM driver and its gormlite dialect. Read when working with SQLite in Go without CGO. This driver is optional -- not every project needs it.

Database choice

Services in this repo generally use PostgreSQL for production databases. The mi service is an exception that uses SQLite because it is a small, self-contained personal service where an embedded database makes sense. When creating a new service, default to Postgres unless there is a specific reason to use SQLite (single-user, embedded, no external DB dependency needed).

The DAO pattern

Related skills
Installs
4
Repository
xe/skills
GitHub Stars
5
First Seen
Mar 31, 2026