Skip to content
Skillv1.0.0

data

internal/data/ — Ent + repositories

by aonoa(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from aonoa/base-server (internal/data/AGENTS.md). Install upstream with npx 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/ (not internal/data/ent/).
  • Re-run make ent and 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)

Caching (local)

  • internal/data/data.go creates a Ristretto-backed gocache manager.

Repo implementation

  • internal/data/base.go implements biz.BaseRepo using Ent queries.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/aonoa-base-server-data/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

aonoa-base-server-data.ocm.jsonjson
{
  "ocm": "1",
  "id": "aonoa-base-server-data",
  "kind": "skill",
  "name": "data",
  "description": "internal/data/ — Ent + repositories",
  "publisher": "aonoa",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "github-agents"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "internal/data/ — Ent + repositories"
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github-agents",
      "repository": "https://github.com/aonoa/base-server",
      "path": "internal/data/AGENTS.md",
      "ref": "1d014f5cdfb7728f15cad3fa43a76307f118fc3e",
      "url": "https://github.com/aonoa/base-server/blob/1d014f5cdfb7728f15cad3fa43a76307f118fc3e/internal/data/AGENTS.md",
      "key": "aonoa/base-server/internal/data/AGENTS.md"
    }
  },
  "instructions": "# internal/data/ — Ent + repositories\n\n## Source vs generated (Ent)\n- Edit schemas: `internal/data/schema/*.go`\n- Edit templates: `internal/data/template/*.tmpl`\n- Do not edit: `internal/data/ent/**` (generated)\n\n## Generate Ent\n- From repo root: `make ent`\n\n## If Ent changes don’t show up\n- Make sure you edited `internal/data/schema/` (not `internal/data/ent/`).\n- Re-run `make ent` and recompile.\n\n## DB init + migrations\n- `internal/data/data.go`:\n  - opens DB using `conf.Data.Database.{Driver,Source}`\n  - creates Ent client\n  - runs `client.Schema.Create(...)` on startup (auto-migration)\n\n##",
  "cost": {
    "context_tokens": 195
  }
}

Fetch it by URL: GET /api/v1/registry/aonoa-base-server-data/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.