{"id":17920888,"url":"https://github.com/eth-p/go-goptional","last_synced_at":"2025-04-03T11:12:57.087Z","repository":{"id":62866056,"uuid":"448222102","full_name":"eth-p/go-goptional","owner":"eth-p","description":"Optional type using Go 1.18 generics.","archived":false,"fork":false,"pushed_at":"2022-01-15T09:12:30.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T00:26:01.772Z","etag":null,"topics":[],"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/eth-p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-15T08:28:29.000Z","updated_at":"2022-04-02T04:34:09.000Z","dependencies_parsed_at":"2022-11-08T06:32:05.777Z","dependency_job_id":null,"html_url":"https://github.com/eth-p/go-goptional","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fgo-goptional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fgo-goptional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fgo-goptional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eth-p%2Fgo-goptional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eth-p","download_url":"https://codeload.github.com/eth-p/go-goptional/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989750,"owners_count":20865331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-28T20:29:30.698Z","updated_at":"2025-04-03T11:12:57.053Z","avatar_url":"https://github.com/eth-p.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go.eth-p.dev/goptional\n**G**eneric **Optional** (or **G**o **Optional**, if you prefer)\n\n`goptional` is a package that provides an implementation of an `Optional[T]` monad using Go 1.18 generics.\n\n\n## Installation\n\n```go\nimport (\n    \"go.eth-p.dev/goptional\"\n)\n```\n\n## Why goptional?\n\n- [x] Prevents you from using uninitialized values. \n- [x] No code generation required.\n- [x] Type-safe API.\n- [ ] Supports marshalling and unmarshalling. (TODO)\n\n## Example\n\n```go\n\nimport (\n    \"os\"\n    \n    optional \"go.eth-p.dev/goptional\"\n)\n\nfunc getConfigDirectory() optional.Optional[string] {\n    return optional.From(os.LookupEnv(\"XDG_CONFIG_HOME\"))\n}\n\nfunc main() {\n    configDir := getConfigDirectory().\n        UnwrapOr(\"~/.config\")\n    \n    println(configDir)\n}\n```\n\nFor more detailed examples, feel free to check out the [examples directory](examples).\n\n\n## License\n\n[MIT License](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-p%2Fgo-goptional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feth-p%2Fgo-goptional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feth-p%2Fgo-goptional/lists"}