{"id":34121597,"url":"https://github.com/ozgio/coalesce","last_synced_at":"2026-06-01T04:02:31.181Z","repository":{"id":57599248,"uuid":"249836370","full_name":"ozgio/coalesce","owner":"ozgio","description":"A go library of coalesce functions which return the first non-nil/non-zero value in their arguments. ","archived":false,"fork":false,"pushed_at":"2022-04-04T06:58:22.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T07:45:27.843Z","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/ozgio.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":"2020-03-24T22:58:18.000Z","updated_at":"2020-03-24T23:03:15.000Z","dependencies_parsed_at":"2022-08-28T18:33:11.686Z","dependency_job_id":null,"html_url":"https://github.com/ozgio/coalesce","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ozgio/coalesce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgio%2Fcoalesce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgio%2Fcoalesce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgio%2Fcoalesce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgio%2Fcoalesce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozgio","download_url":"https://codeload.github.com/ozgio/coalesce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgio%2Fcoalesce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33759180,"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-01T02:00:06.963Z","response_time":115,"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":[],"created_at":"2025-12-14T21:53:03.166Z","updated_at":"2026-06-01T04:02:31.169Z","avatar_url":"https://github.com/ozgio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Coalesce\n========\n\nCoalesce functions returns the first non-nil/non-zero argument. \n\n## Functions\n\n### Any ([Docs](https://godoc.org/github.com/ozgio/coalesce#Any))\nAny returns the first non empty value. Nils, zero values, empty arrays/slices/maps/channels regarded\nas empty\n\n```go\ncoalesce.Any(nil, 42) //-\u003e 42 \ncoalesce.Any([]int{}, 0, \"\",  42) //-\u003e 42\n```\n\n### String ([Docs](https://godoc.org/github.com/ozgio/coalesce#String))\nString returns the first non-empty string\n\nExample:\n```go\ncoalesce.String(\"\", \"Hello\", \"\", \"World\") //-\u003e \"Hello\"\n```\n\n### Duration ([Docs](https://godoc.org/github.com/ozgio/coalesce#Duration))\nDuration returns the first non-zero duration\nExample:\n```go\nvar zeroDur time.Duration\ncoalesce.Duration(zeroDur, time.Second, 0, -1 * time.Second) //-\u003e time.Second\n```\n\n### Time ([Docs](https://godoc.org/github.com/ozgio/coalesce#Time))\nTime returns the first non-zero time\n\nExample:\n```go\nvar zeroTime time.Time\nvar now := time.Now()\ncoalesce.Time(zeroTime, time.Now()) //-\u003e now\n```\n\n### Error ([Docs](https://godoc.org/github.com/ozgio/coalesce#Error))\nError returns the first non-nil error\n\nExample:\n```go\ncoalesce.Error(nil, errors.New(\"err 1\"), errors.New(\"err 2\")) //-\u003e r.Error() = \"err 1\"\n```\n\n### Byte ([Docs](https://godoc.org/github.com/ozgio/coalesce#Byte))\nByte returns the first non-zero byte\n\nExample:\n```go\ncoalesce.Byte(0, 1, 0, -1) //-\u003e 1\n```\n\n### Rune ([Docs](https://godoc.org/github.com/ozgio/coalesce#Rune))\nRune returns the first non-zero rune\n\nExample:\n```go\ncoalesce.Rune(0, 1, 0, -1) //-\u003e 1\n```\n\n### Int ([Docs](https://godoc.org/github.com/ozgio/coalesce#Int))\nInt returns the first non-zero int\n\nExample:\n```go\ncoalesce.Int(0, 1, 0, -1) //-\u003e 1\n```\n\n### Int8 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Int8))\nInt8 returns the first non-zero int8\n\nExample:\n```go\ncoalesce.Int8(0, 1, 0, -1) //-\u003e 1\n```\n\n### Int16 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Int16))\nInt16 returns the first non-zero int16\n\nExample:\n```go\ncoalesce.Int16(0, 1, 0, -1) //-\u003e 1\n```\n\n### Int32 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Int32))\nInt32 returns the first non-zero int32\n\nExample:\n```go\ncoalesce.Int32(0, 1, 0, -1) //-\u003e 1\n```\n\n### Int64 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Int64))\nInt64 returns the first non-zero int64\n\nExample:\n```go\ncoalesce.Int64(0, 1, 0, -1) //-\u003e 1\n```\n\n### Uint ([Docs](https://godoc.org/github.com/ozgio/coalesce#Uint))\nUint returns the first non-zero int\n\nExample:\n```go\ncoalesce.Uint(0, 1, 0) //-\u003e 1\n```\n\n### Uint8 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Uint8))\nUint8 returns the first non-zero int8\n\nExample:\n```go\ncoalesce.Uint8(0, 1, 0) //-\u003e 1\n```\n\n### Uint16 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Uint16))\nUint16 returns the first non-zero int16\n\nExample:\n```go\ncoalesce.Uint16(0, 1, 0) //-\u003e 1\n```\n\n### Uint32 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Uint32))\nUint32 returns the first non-zero int32\n\nExample:\n```go\ncoalesce.Uint32(0, 1, 0) //-\u003e 1\n```\n\n### Uint64 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Uint64))\nUint64 returns the first non-zero int64\n\nExample:\n```go\ncoalesce.Uint64(0, 1, 0) //-\u003e 1\n```\n\n### Float32 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Float32))\nFloat32 returns the first non-zero float32\n\nExample:\n```go\ncoalesce.Float32(0, 1, 0, -1) //-\u003e 1\n```\n\n### Float64 ([Docs](https://godoc.org/github.com/ozgio/coalesce#Float64))\nFloat64 returns the first non-zero float64\n\nExample:\n```go\ncoalesce.Float64(0, 1, 0, -1) //-\u003e 1\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgio%2Fcoalesce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozgio%2Fcoalesce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgio%2Fcoalesce/lists"}