{"id":20324338,"url":"https://github.com/oniani/set","last_synced_at":"2025-08-25T01:05:28.899Z","repository":{"id":65141047,"uuid":"582222545","full_name":"oniani/set","owner":"oniani","description":"A generic set implementation for the Go programming language","archived":false,"fork":false,"pushed_at":"2022-12-28T08:26:22.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-12T10:54:20.279Z","etag":null,"topics":[],"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/oniani.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-12-26T06:08:23.000Z","updated_at":"2022-12-28T07:59:38.000Z","dependencies_parsed_at":"2023-01-09T13:01:17.119Z","dependency_job_id":null,"html_url":"https://github.com/oniani/set","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oniani/set","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniani%2Fset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniani%2Fset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniani%2Fset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniani%2Fset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oniani","download_url":"https://codeload.github.com/oniani/set/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniani%2Fset/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270617837,"owners_count":24617122,"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-08-15T02:00:12.559Z","response_time":110,"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":"2024-11-14T19:33:37.451Z","updated_at":"2025-08-15T19:17:14.691Z","avatar_url":"https://github.com/oniani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# set\n\nA generic set implementation for the Go programming language.\n\nThe implementation makes use of the built-in `map` data structure.\n\n**TODO**:\n\n- Add tests\n- Add docs\n\n## API\n\n```go\nimport \"github.com/oniani/set\"\n\nfunc main() {\n    // Two ways to create and populate a set\n    s := Set.New(\"Apple\", \"Banana\", \"Cherry\")\n    t := Set.New[string]()\n    t.Add(\"Raspberry\")\n    t.Add(\"Strawberry\")\n    t.Add(\"Apple\")\n\n    // Check the results\n    fmt.Println(s, s.Len())\n    fmt.Println(t, t.Len())\n\n    // Union, intersection, and difference\n    m := s.Union(t)\n    n := s.Intersection(t)\n    o := s.Difference(t)\n\n    // Check the Results\n    fmt.Println(m, m.Len())\n    fmt.Println(n, n.Len())\n    fmt.Println(o, o.Len())\n\n    sHasApple, sHasCar = s.Contains(\"Apple\"), s.Contains(\"Car\")\n    sHasAll1, sHasAll2 = s.All(\"Car\", \"Laptop\", \"Popcorn\"), s.All(\"Car\", \"Laptop\", \"Apple\")\n    sHasAny1, sHasAny2 = m.Any(\"Car\", \"Laptop\", \"Popcorn\"), m.Any(\"Car\", \"Laptop\", \"Apple\")\n\n    // Check the results\n    fmt.Println(sHasApple, sHasCar)\n    fmt.Println(sHasAll1, sHasAll2)\n    fmt.Println(s_has_any1, sHasAny2)\n\n    // Clone, remove, and clear\n    p := s.Clone()\n    p.Remove(\"Apple\")\n    s.Clear()\n\n    // Check the results\n    fmt.Println(s, s.Len())\n    fmt.Println(p, p.Len())\n}\n```\n\n## Testing\n\n- Unit Tests: Done (partially)\n\n```console\n$ go test -v\n```\n\n- Fuzz Tests: Done (partially)\n\n```console\n$ go test -v -fuzz FuzzAddRemoveString -fuzztime 16s\n```\n\n## License\n\n[MIT License][license]\n\n[godoc]: https://pkg.go.dev/golang.org/x/tools/cmd/godoc\n[license]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foniani%2Fset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foniani%2Fset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foniani%2Fset/lists"}