Imported from aonoa/base-server (
internal/data/AGENTS.md). Install upstream withnpx skills add aonoa/base-server --skill data. Copyright stays with the author.
internal/data/ — Ent + repositories
Source vs generated (Ent)
- Edit schemas:
internal/data/schema/*.go - Edit templates:
internal/data/template/*.tmpl - Do not edit:
internal/data/ent/**(generated)
Generate Ent
- From repo root:
make ent
If Ent changes don’t show up
- Make sure you edited
internal/data/schema/(notinternal/data/ent/). - Re-run
make entand recompile.
DB init + migrations
internal/data/data.go:- opens DB using
conf.Data.Database.{Driver,Source} - creates Ent client
- runs
client.Schema.Create(...)on startup (auto-migration)
- opens DB using
Caching (local)
internal/data/data.gocreates a Ristretto-backedgocachemanager.
Repo implementation
internal/data/base.goimplementsbiz.BaseRepousing Ent queries.