{"id":51039279,"url":"https://github.com/brandonkramer/registry","last_synced_at":"2026-06-22T09:30:27.980Z","repository":{"id":361658707,"uuid":"1255298838","full_name":"brandonkramer/registry","owner":"brandonkramer","description":"Thread-safe generic name registry with optional validation, key extraction, and duplicate policy.","archived":false,"fork":false,"pushed_at":"2026-05-31T16:56:36.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-31T18:25:26.809Z","etag":null,"topics":["generics","go","golang","library","registry"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brandonkramer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T16:54:05.000Z","updated_at":"2026-05-31T16:57:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/brandonkramer/registry","commit_stats":null,"previous_names":["brandonkramer/registry"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brandonkramer/registry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonkramer%2Fregistry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonkramer%2Fregistry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonkramer%2Fregistry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonkramer%2Fregistry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandonkramer","download_url":"https://codeload.github.com/brandonkramer/registry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandonkramer%2Fregistry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34643409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generics","go","golang","library","registry"],"created_at":"2026-06-22T09:30:25.861Z","updated_at":"2026-06-22T09:30:27.974Z","avatar_url":"https://github.com/brandonkramer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# registry\n\nThread-safe generic name registry with optional validation, key extraction, and duplicate policy.\n\n## Quick start\n\n```go\nreg := registry.New[Plugin](\n    registry.WithValidator(func(p Plugin) error {\n        if p.Name == \"\" {\n            return fmt.Errorf(\"empty name\")\n        }\n        return nil\n    }),\n    registry.WithKeyFrom(func(p Plugin) string { return p.Name }),\n)\nreg.MustRegisterItem(Plugin{Name: \"alpha\"})\n\np, err := reg.Get(\"alpha\")\nif errors.Is(err, registry.ErrNotFound) {\n    // unknown name\n}\n\nsnap := reg.Snapshot() // safe map copy for iteration\n```\n\n## Options\n\n| Option | Effect |\n|--------|--------|\n| `WithValidator(fn)` | Validate before register |\n| `WithKeyFrom(fn)` | Enable `RegisterItem` / `MustRegisterItem` |\n| `WithRejectDuplicates()` | `Register` returns `ErrExists` instead of replacing |\n\nBy default, registering the same name **replaces** the previous value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonkramer%2Fregistry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandonkramer%2Fregistry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonkramer%2Fregistry/lists"}