{"id":50677260,"url":"https://github.com/limboware/opts","last_synced_at":"2026-06-08T16:05:58.553Z","repository":{"id":318714190,"uuid":"1072466648","full_name":"limboware/opts","owner":"limboware","description":"Too simple, zero-dependencies library to flexible passing of dynamic params into variadic functions.","archived":false,"fork":false,"pushed_at":"2026-06-03T17:55:31.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2026-06-03T19:07:37.347Z","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/limboware.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":"2026-06-03T17:48:02.000Z","dependencies_parsed_at":"2025-10-11T02:54:18.455Z","dependency_job_id":"1e844c10-9264-4aad-bdd0-c20f5e810091","html_url":"https://github.com/limboware/opts","commit_stats":null,"previous_names":["rosemound/opts","limboware/opts"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/limboware/opts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limboware%2Fopts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limboware%2Fopts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limboware%2Fopts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limboware%2Fopts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limboware","download_url":"https://codeload.github.com/limboware/opts/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limboware%2Fopts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069529,"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-08T02:00:07.615Z","response_time":111,"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":["1ib","dynamic-params","go","golang","golib","options","opts","utils","variadic-functions"],"created_at":"2026-06-08T16:05:58.493Z","updated_at":"2026-06-08T16:05:58.547Z","avatar_url":"https://github.com/limboware.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/v2.svg)](https://pkg.go.dev/github.com/rosemound/opts/v2)\n  [![Go Report Card](https://goreportcard.com/badge/github.com/rosemound/opts/v2)](https://goreportcard.com/report/github.com/rosemound/opts/v2)\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\ts := service{}\n\n\t// extract values from container with res handling\n\tif !opts.OptionValue(c, OwnerKey, \u0026s.owner) {\n\t\treturn nil, errors.New(\"some err\")\n\t}\n\n\t// or ignore \n\t_ = opts.OptionValue(c, CompanyKey, \u0026s.company)\n\n\t// ret your instance\n\treturn \u0026s, 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%2Flimboware%2Fopts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimboware%2Fopts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimboware%2Fopts/lists"}