BloomFilter is a simple and efficient implementation of a Bloom filter in Go.
To install the package, run:
go get github.com/beastop/bloomfilter
package main
import (
"fmt"
"github.com/beastop/bloomfilter"
)
func main() {
// Create a new Bloom filter
bloom, err := bloomfilter.New(100, 0.01)
if err != nil {
fmt.Println("Error:", err)
return
}
// Add items to the Bloom filter
bloom.Add("foo")
bloom.Add("bar")
// Check if items are in the Bloom filter
fmt.Println("foo in bloom filter:", bloom.Contains("foo"))
fmt.Println("baz in bloom filter:", bloom.Contains("baz"))
}
For detailed API documentation, please visit the GoDoc.
This project is licensed under the MIT License. See the LICENSE file for details.