{"id":17043410,"url":"https://github.com/leavez/go-either","last_synced_at":"2025-06-15T13:33:47.549Z","repository":{"id":57662974,"uuid":"479389032","full_name":"leavez/go-either","owner":"leavez","description":"An Either type for golang with generics","archived":false,"fork":false,"pushed_at":"2022-04-08T13:52:58.000Z","size":3,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T05:09:56.954Z","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/leavez.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}},"created_at":"2022-04-08T12:51:18.000Z","updated_at":"2024-09-21T13:19:52.000Z","dependencies_parsed_at":"2022-09-13T00:32:54.028Z","dependency_job_id":null,"html_url":"https://github.com/leavez/go-either","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leavez%2Fgo-either","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leavez%2Fgo-either/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leavez%2Fgo-either/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leavez%2Fgo-either/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leavez","download_url":"https://codeload.github.com/leavez/go-either/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245044493,"owners_count":20551898,"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-14T09:29:29.228Z","updated_at":"2025-03-23T01:43:24.515Z","avatar_url":"https://github.com/leavez.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-either\n\nAn Either type for golang with generics\n\n```golang\ne := either.NewLeft[int, string](1) // either.Type[int, string]\n\nl, r, isLeft := e.Unwrap()\nif isLeft {  // true\n  print(l)   // l is 1\n} else {\n  print(r)\n}\n\ne.EitherDo(func(l int) {\n  print(l)\n}, func(r string) {\n  print(r)\n})\n\neither.MapLeft(e, func(left int) *int {\n  return \u0026left\n}) // either.Type[*int, string]\n\n// either.MapRight\n// either.Map\n```\n\nand the Result type, based on `either.Type`\n\n```golang\nr := result.New(123) // result.Type[int]\nr.IsError() // false\n\nif w, err := r.Unwrap(); err != nil {\n  print(w) // 123\n}\n\nresult.Map(r, func(t int) string {\n  return \"123\"\n}) // result.Type[string]\n\nr.MapError(func(err error) error {\n  return fmt.Errorf(\"faile: %w\", err)\n}) // equals r, as MapError will only execute when r is error result\n```\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleavez%2Fgo-either","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleavez%2Fgo-either","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleavez%2Fgo-either/lists"}