{"id":19221192,"url":"https://github.com/gozeloglu/set","last_synced_at":"2026-01-04T05:44:10.585Z","repository":{"id":42982107,"uuid":"464242896","full_name":"gozeloglu/set","owner":"gozeloglu","description":"Thread(Safe/Unsafe) Set data structure for Go.","archived":false,"fork":false,"pushed_at":"2022-03-30T19:05:22.000Z","size":127,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-25T16:22:39.507Z","etag":null,"topics":["data-structure","go","golang","hash","hash-se","set","thread-safe","thread-safety"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/gozeloglu/set","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/gozeloglu.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-02-27T20:15:33.000Z","updated_at":"2023-09-30T13:43:47.000Z","dependencies_parsed_at":"2022-09-06T11:11:24.388Z","dependency_job_id":null,"html_url":"https://github.com/gozeloglu/set","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozeloglu%2Fset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozeloglu%2Fset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozeloglu%2Fset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozeloglu%2Fset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gozeloglu","download_url":"https://codeload.github.com/gozeloglu/set/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244659907,"owners_count":20489244,"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":["data-structure","go","golang","hash","hash-se","set","thread-safe","thread-safety"],"created_at":"2024-11-09T14:40:25.259Z","updated_at":"2026-01-04T05:44:10.543Z","avatar_url":"https://github.com/gozeloglu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# set [![Go Reference](https://pkg.go.dev/badge/github.com/gozeloglu/set.svg)](https://pkg.go.dev/github.com/gozeloglu/set) [![Go Report Card](https://goreportcard.com/badge/github.com/gozeloglu/set)](https://goreportcard.com/report/github.com/gozeloglu/set) [![GoCover](http://gocover.io/_badge/github.com/gozeloglu/set)](http://gocover.io/github.com/gozeloglu/set)\n\n`set` is a data structure package written by **Go**. It provides some basic set functionalities of the user. It uses \n`map` data structure under the hood. \n\n* Written in vanilla Go with no dependency.\n* Supports thread-safety.\n* Two different set options. Thread-safe and Thread-unsafe.\n* Supports any data type(integer, float, string, byte, and so on).\n\n## Installation\n\n```shell\ngo get github.com/gozeloglu/set\n```\n\n\n## Thread Unsafe Set Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/gozeloglu/set\"\n)\n\nfunc main() {\n\tunsafeSet := set.New(set.ThreadUnsafe)\n\tunsafeSet.Add(123)\n\n\texist := unsafeSet.Contains(123)\n\tif !exist {\n\t\tfmt.Println(\"123 not exist\")\n\t}\n\n\tunsafeSet.Append(1, 2, 3, 4, \"abc\")    // Add multiple values\n\tvalues := []interface{}{\"github\", 100, 640, 0.43, false}\n\tunsafeSet.Append(values...) // Append the array of elements \n\n\tunsafeSet.Remove(4)\n\tsize := unsafeSet.Size()\n\tfmt.Println(size)   // Prints 5\n\n\tunsafeSet.Pop()    // Returns random value from the set\n\tunsafeSet.Clear()\n\tfmt.Println(unsafeSet.Size())   // Prints 0\n\t\n\tif unsafeSet.Empty() {\n            fmt.Println(\"set is empty\")\n        }   \n}\n```\n\n## Thread Safe Set Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/gozeloglu/set\"\n)\n\nfunc main() {\n\tsafeSet := set.New(set.ThreadSafe)\n\tsafeSet.Append(1, 2, 3, 4)  // Add multiple values\n\n\texist := safeSet.Contains(2)\n\tif !exist {\n\t\tfmt.Println(\"2 not exist\")\n\t}\n\n\tvalues := []interface{}{\"github\", 100, 640, 0.43, false}\n\tsafeSet.Append(values...) // Append the array of elements \n\n\tsafeSet.Remove(4)\n\tsize := safeSet.Size()\n\tfmt.Println(size)\n\n\tsafeSet.Pop()\n\tsafeSet.Clear()\n\tfmt.Println(safeSet.Size())\n\t\n\tif safeSet.Empty() {\n            fmt.Println(\"set is empty\")\n        }   \n}\n```\n\n## Supported methods\n\n* `Add(val interface{})`\n* `Append(val ...interface{})`\n* `Remove(val interface{})`\n* `Contains(val interface{})`\n* `Size()`\n* `Pop()`\n* `Clear()`\n* `Empty()`\n* `Slice()`\n* `Union()`\n* `Intersection()`\n* `Difference()`\n* `IsSubset()`\n* `IsSuperset()`\n* `IsDisjoint()`\n* `Equal()`\n* `SymmetricDifference()`\n\n## Tests\n\n  You can run the tests with the following command.\n\n```shell\nmake test   # Runs all tests\nmake test-v # Runs all tests with -v option\nmake cover  # Runs all tests with -cover option. Prints out coverage result\nmake race   # Runs all tests with -race option. \nmake bench  # Runs benchmarks\n```\n\n## LICENSE\n\n[MIT](https://github.com/gozeloglu/set/blob/main/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgozeloglu%2Fset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgozeloglu%2Fset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgozeloglu%2Fset/lists"}