Go client for RedisBloom (https://github.com/RedisBloom/redisbloom), based on redigo.
$ go get github.com/RedisBloom/redisbloom-goA simple test suite is provided, and can be run with:
$ go testThe tests expect a Redis server with the RedisBloom module loaded to be available at localhost:6379. You can easily launch RedisBloom with Docker in the following manner:
docker run -d -p 6379:6379 --name redis-redisbloom redis/redis-stack-server:latest
Make sure to check the full list of examples at Pkg.go.dev.
package main
import (
"fmt"
redisbloom "github.com/RedisBloom/redisbloom-go"
)
func main() {
// Connect to localhost with no password
var client = redisbloom.NewClient("localhost:6379", "nohelp", nil)
// BF.ADD mytest item
_, err := client.Add("mytest", "myItem")
if err != nil {
fmt.Println("Error:", err)
}
exists, err := client.Exists("mytest", "myItem")
if err != nil {
fmt.Println("Error:", err)
}
fmt.Println("myItem exists in mytest: ", exists)
}Make sure to check the full command reference at redisbloom.io.
| Command | Recommended API and godoc |
|---|---|
| BF.RESERVE | Reserve |
| BF.ADD | Add |
| BF.MADD | BfAddMulti |
| BF.INSERT | BfInsert |
| BF.EXISTS | Exists |
| BF.MEXISTS | BfExistsMulti |
| BF.SCANDUMP | BfScanDump |
| BF.LOADCHUNK | BfLoadChunk |
| BF.INFO | Info |
| Command | Recommended API and godoc |
|---|---|
| CF.RESERVE | CfReserve |
| CF.ADD | CfAdd |
| CF.ADDNX | CfAddNx |
| CF.INSERT | CfInsert |
| CF.INSERTNX | CfInsertNx |
| CF.EXISTS | CfExists |
| CF.DEL | CfDel |
| CF.COUNT | CfCount |
| CF.SCANDUMP | CfScanDump |
| CF.LOADCHUNK | CfLoadChunk |
| CF.INFO | CfInfo |
| Command | Recommended API and godoc |
|---|---|
| CMS.INITBYDIM | CmsInitByDim |
| CMS.INITBYPROB | CmsInitByProb |
| CMS.INCRBY | CmsIncrBy |
| CMS.QUERY | CmsQuery |
| CMS.MERGE | CmsMerge |
| CMS.INFO | CmsInfo |
| Command | Recommended API and godoc |
|---|---|
| TOPK.RESERVE | TopkReserve |
| TOPK.ADD | TopkAdd |
| TOPK.INCRBY | TopkIncrby |
| TOPK.QUERY | TopkQuery |
| TOPK.COUNT | TopkCount |
| TOPK.LIST | TopkList |
| TOPK.INFO | TopkInfo |
redisbloom-go is distributed under the BSD 3-Clause license - see LICENSE