go_bloom_filter

package module
v0.0.0-...-7e9002d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 3 Imported by: 0

README

A Simple Bloom Filter for Go

Build Status

Install
go get github.com/sysatom/go_bloom_filter
Usage
package main

import (
	"fmt"
	"github.com/sysatom/go_bloom_filter"
)

func main() {
	bf := go_bloom_filter.NewBloomFilter(100000, 7)
	for i := 0; i < 5000; i++ {
		bf.Add(fmt.Sprintf("%d", i))
	}
	fmt.Println(bf.Lookup("333"))
	fmt.Println(bf.Lookup("100000"))
	fmt.Println(bf.Lookup("500001"))
	fmt.Println(bf.Lookup("510001"))
}
Requirements

This project requires Go 1.14 or newer.

License

You can find the license for this code in the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter struct {
	// contains filtered or unexported fields
}

func NewBloomFilter

func NewBloomFilter(size uint, hashCount uint) *BloomFilter

func (*BloomFilter) Add

func (bf *BloomFilter) Add(value string)

func (BloomFilter) Lookup

func (bf BloomFilter) Lookup(value string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL