{"id":37140122,"url":"https://github.com/ensteinjun/go-bloomfilter","last_synced_at":"2026-01-14T16:25:08.936Z","repository":{"id":65804581,"uuid":"599999650","full_name":"Ensteinjun/go-bloomfilter","owner":"Ensteinjun","description":"bloomfilter for golang","archived":false,"fork":false,"pushed_at":"2023-02-17T11:26:39.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-21T15:36:48.945Z","etag":null,"topics":["bloomfilter","go","golang"],"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/Ensteinjun.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":"2023-02-10T11:01:59.000Z","updated_at":"2023-02-21T03:20:54.000Z","dependencies_parsed_at":"2023-02-23T10:00:25.399Z","dependency_job_id":null,"html_url":"https://github.com/Ensteinjun/go-bloomfilter","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"c73e32ca9d397642e42739f3092959c7f41990c0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Ensteinjun/go-bloomfilter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ensteinjun%2Fgo-bloomfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ensteinjun%2Fgo-bloomfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ensteinjun%2Fgo-bloomfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ensteinjun%2Fgo-bloomfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ensteinjun","download_url":"https://codeload.github.com/Ensteinjun/go-bloomfilter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ensteinjun%2Fgo-bloomfilter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bloomfilter","go","golang"],"created_at":"2026-01-14T16:25:08.443Z","updated_at":"2026-01-14T16:25:08.932Z","avatar_url":"https://github.com/Ensteinjun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-bloomfilter\n[![Go Reference](https://pkg.go.dev/badge/github.com/Ensteinjun/go-bloomfilter.svg)](https://pkg.go.dev/github.com/Ensteinjun/go-bloomfilter)\n\nbloomfilter for golang\n\n## Containers\n```golang\n// Implement this interface and make a custom container\nbloomfilter.BFContainer\n\n// Support\nbloomfilter.NewMemoryBloomFilter\nbloomfilter.NewRedisContainer\nbloomfilter.NewRedisClusterContainer\n```\n\n\n## Example\n```golang\n// option 1: memorty bloom filter\nbf := bloomfilter.NewMemoryBloomFilter(100000, 0.001)\n\n// option 2: redis bloom filter\nrdc := container.NewRedisContainer(\u0026redis.Options{}, \"bf_demo\", 2)\nbf := bloomfilter.NewBloomFilter(100000, 0.001, rdc)\n\n// option 3: redis bloom filter\nrdc1 := container.NewRedisClusterContainer(\u0026redis.ClusterOptions{}, \"bf_demo\", 2)\nbf := bloomfilter.NewBloomFilter(100000, 0.001, rdc1)\n\nbf.Add([]byte(\"hello\"))\nbf.Add([]byte(\"world\"))\nfmt.Printf(\"Capacity: %d\\n\", bf.Capacity())\nfmt.Printf(\"Size: %d\\n\", bf.Size())\nfmt.Printf(\"Error: %f\\n\", bf.Error())\nfmt.Printf(\"Exists[hello]: %v\\n\", bf.Contains([]byte(\"hello\")))\nfmt.Printf(\"Exists[world]: %v\\n\", bf.Contains([]byte(\"world\")))\nfmt.Printf(\"Exists[golang]: %v\\n\", bf.Contains([]byte(\"golang\")))\n\n// save bloomfilter to file\nwriter, err := os.OpenFile(\"./test.bf\", os.O_WRONLY|os.O_CREATE, 0666)\nif err != nil {\n    log.Fatalf(\"write failed failed: %v\", err)\n}\nbf.Save(writer)\n\n/*\nLoad bloomfilter from File\n\nIt is necessary to ensure that the two values ​​of hashFunction and container.GetMaxBitSize() cannot be changed, otherwise the bloomfilter of load cannot work correctly\n*/ \nfmt.Println(\"Load Bloom Filter\")\nbf2, err := bloomfilter.LoadBloomFilter(\"./test.bf\", container.NewMemoryContainer(), nil)\nif err != nil {\n    log.Fatalf(\"load bloom filter failed: %v\", err)\n}\nfmt.Printf(\"Exists[hello]: %v\\n\", bf2.Contains([]byte(\"hello\")))\nfmt.Printf(\"Exists[world]: %v\\n\", bf2.Contains([]byte(\"world\")))\nfmt.Printf(\"Exists[golang]: %v\\n\", bf2.Contains([]byte(\"golang\")))\nfmt.Printf(\"Capacity: %d\\n\", bf2.Capacity())\nfmt.Printf(\"Size: %d\\n\", bf2.Size())\nfmt.Printf(\"Error: %f\\n\", bf2.Error())\n```\n\n## Run Test\n```shell\ngo test\n```\n\n## License\n[MIT License Copyright (c) 2023 coderjun](http://opensource.org/licenses/MIT)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fensteinjun%2Fgo-bloomfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fensteinjun%2Fgo-bloomfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fensteinjun%2Fgo-bloomfilter/lists"}