{"id":37096681,"url":"https://github.com/rosemound/opts","last_synced_at":"2026-01-14T11:53:48.870Z","repository":{"id":318714190,"uuid":"1072466648","full_name":"Rosemound/opts","owner":"Rosemound","description":"Too simple, zero-dependencies library to flexible passing of dynamic params into variadic functions.","archived":false,"fork":false,"pushed_at":"2025-12-25T13:06:21.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2025-12-27T00:21:19.195Z","etag":null,"topics":["1ib","dynamic-params","go","golang","golib","options","opts","utils","variadic-functions"],"latest_commit_sha":null,"homepage":"","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/Rosemound.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":"2025-10-08T18:58:31.000Z","updated_at":"2025-12-25T12:34:28.000Z","dependencies_parsed_at":"2025-10-11T02:54:18.455Z","dependency_job_id":"1e844c10-9264-4aad-bdd0-c20f5e810091","html_url":"https://github.com/Rosemound/opts","commit_stats":null,"previous_names":["rosemound/opts"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Rosemound/opts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rosemound%2Fopts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rosemound%2Fopts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rosemound%2Fopts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rosemound%2Fopts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rosemound","download_url":"https://codeload.github.com/Rosemound/opts/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rosemound%2Fopts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["1ib","dynamic-params","go","golang","golib","options","opts","utils","variadic-functions"],"created_at":"2026-01-14T11:53:48.220Z","updated_at":"2026-01-14T11:53:48.863Z","avatar_url":"https://github.com/Rosemound.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eOPTS\u003c/h1\u003e\n  \u003cp align=\"center\"\u003eToo simple, zero-dependencies library to flexible passing dynamic options\u003c/p\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  [![Test \u0026 Build](https://github.com/rosemound/opts/actions/workflows/build.yml/badge.svg)](https://github.com/rosemound/opts/actions/workflows/build.yml)\n  [![Go Reference](https://pkg.go.dev/badge/github.com/rosemound/opts.svg)](https://pkg.go.dev/github.com/rosemound/opts)\n  [![Go Report Card](https://goreportcard.com/badge/github.com/rosemound/opts)](https://goreportcard.com/report/github.com/rosemound/opts)\n  \n\u003c/div\u003e\n\n### About\nToo simple, zero-dependencies library to flexible passing of dynamic params into variadic functions.\n\n### Installation\n```bash\ngo get github.com/rosemound/opts/v2\n```\n\n### Usage mapped opts\n```go\nimport (\n\t\"context\"\n\t\"errors\"\n\n\t\"github.com/rosemound/opts/v2\"\n)\n\n// Mapped option key type\ntype OptionKey string\n\n// Owner key\nconst OwnerKey OptionKey = \"owner\"\n\n// Company key (like ctx keys)\nconst CompanyKey OptionKey = \"company\"\n\n// simple service\ntype service struct {\n\towner   string\n\tcompany any\n}\n\n// main\nfunc main() {\n\n\t// service instantination with dynamic params\n\ts, err := NewService(context.Background(), WithCompany(\"test\"), WithOwner(\"test\"))\n\n\t// err handling\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// do staff\n}\n\nfunc NewService(ctx context.Context, o ...opts.Option[OptionKey]) (*service, error){\n\n\t// init option container with err handling\n\tc, err := opts.CreateContainerWithOptions(o)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// or silently\n\tc := opts.CreateContainerWithOptionsS(o)\n\n\t// allocate your instance\n\treturn \u0026service{\n\t\towner: conf.Get(OwnerKey).(string),\n\t\tcompany: conf.Get(CompanyKey),\n\t}, nil\n}\n\n// With company\nfunc WithCompany(company any) opts.Option[OptionKey] {\n\treturn func(o opts.OptionContainer[OptionKey]) error {\n\t\to.Set(CompanyKey, company)\n\t\treturn nil\n\t}\n}\n\n// With owner \u0026 err\nfunc WithOwner(val string) opts.Option[OptionKey] {\n\tvar err error\n\n\tif val == \"\" {\n\t\terr = errors.New(\"owner must be present\")\n\t}\n\n\treturn func(o opts.OptionContainer[OptionKey]) error {\n\t\tif err == nil {\n\t\t\to.Set(OwnerKey, val)\n\t\t}\n\n\t\treturn err\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosemound%2Fopts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosemound%2Fopts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosemound%2Fopts/lists"}