{"id":24108180,"url":"https://github.com/rlshukhov/nullable","last_synced_at":"2025-10-05T18:19:25.598Z","repository":{"id":271670232,"uuid":"914191123","full_name":"rlshukhov/nullable","owner":"rlshukhov","description":"Golang nullable package powered by generics","archived":false,"fork":false,"pushed_at":"2025-01-09T06:37:48.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-03T16:56:32.134Z","etag":null,"topics":["generics","generics-in-golang","go","golang","null","nullable"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rlshukhov.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}},"created_at":"2025-01-09T05:48:06.000Z","updated_at":"2025-01-09T06:37:52.000Z","dependencies_parsed_at":"2025-01-10T08:01:42.806Z","dependency_job_id":null,"html_url":"https://github.com/rlshukhov/nullable","commit_stats":null,"previous_names":["rlshukhov/nullable"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rlshukhov/nullable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlshukhov%2Fnullable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlshukhov%2Fnullable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlshukhov%2Fnullable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlshukhov%2Fnullable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rlshukhov","download_url":"https://codeload.github.com/rlshukhov/nullable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rlshukhov%2Fnullable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278495723,"owners_count":25996655,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"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":["generics","generics-in-golang","go","golang","null","nullable"],"created_at":"2025-01-10T23:26:12.819Z","updated_at":"2025-10-05T18:19:25.581Z","avatar_url":"https://github.com/rlshukhov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go](https://github.com/rlshukhov/nullable/actions/workflows/go.yml/badge.svg)](https://github.com/rlshukhov/nullable/actions/workflows/go.yml)\n\n# Nullable\nGolang nullable package powered by generics\n\n## Install\n\n```shell\ngo get github.com/rlshukhov/nullable\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/rlshukhov/nullable\"\n\t\"gopkg.in/yaml.v3\"\n)\n\ntype name struct {\n\tName nullable.Nullable[string] `yaml:\"name\"`\n\tAge  nullable.Nullable[uint64] `yaml:\"age\"`\n}\n\nfunc main() {\n\tvar nilValue *string\n\tvalue := \"Alice\"\n\n\tdata := []name{\n\t\t{nullable.FromValue(\"Bob\"), nullable.Null[uint64]()},\n\t\t{nullable.FromValue(\"\"), nullable.FromValue[uint64](21)},\n\t\t{nullable.FromPointer(nilValue), nullable.FromValue[uint64](34)},\n\t\t{nullable.FromPointer(\u0026value), nullable.FromValue[uint64](45)},\n\t}\n\n\tout, err := yaml.Marshal(\u0026data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(string(out))\n\n\tvar parsedData []name\n\terr = yaml.Unmarshal(out, \u0026parsedData)\n\n\tfor _, d := range parsedData {\n\t\tfmt.Printf(\"Name:\\t%s\\tIsNull:\\t%t\\tHasValue:\\t%t\\n\", d.Name.GetValue(), d.Name.IsNull(), d.Name.HasValue())\n\t\tfmt.Printf(\"Age:\\t%d\\tIsNull:\\t%t\\tHasValue:\\t%t\\n\\n\", d.Age.GetValue(), d.Age.IsNull(), d.Age.HasValue())\n\t}\n}\n```\n\n```shell\nrlshukhov@MacBook-Pro-Lane main % go run main.go\n- name: Bob\n  age: null\n- name: \"\"\n  age: 21\n- name: null\n  age: 34\n- name: Alice\n  age: 45\n\nName:   Bob     IsNull: false   HasValue:       true\nAge:    0       IsNull: true    HasValue:       false\n\nName:           IsNull: false   HasValue:       true\nAge:    21      IsNull: false   HasValue:       true\n\nName:           IsNull: true    HasValue:       false\nAge:    34      IsNull: false   HasValue:       true\n\nName:   Alice   IsNull: false   HasValue:       true\nAge:    45      IsNull: false   HasValue:       true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlshukhov%2Fnullable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frlshukhov%2Fnullable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlshukhov%2Fnullable/lists"}