mirror of
https://github.com/hanzokv/go.git
synced 2026-09-24 00:31:51 +00:00
Update module path from github.com/redis/go-redis/v9 to github.com/hanzoai/kv-go/v9 for use as the Hanzo KV Go SDK. - Update go.mod module declaration - Update all Go imports across 260 files - Update all submodule go.mod files (extra/*, example/*, internal/customvet)
31 lines
453 B
Go
31 lines
453 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/kv-go/v9"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
|
|
rdb := redis.NewClient(&redis.Options{
|
|
Addr: ":6379",
|
|
})
|
|
_ = rdb.FlushDB(ctx).Err()
|
|
|
|
for i := 0; i < 10; i++ {
|
|
if err := rdb.PFAdd(ctx, "myset", fmt.Sprint(i)).Err(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
card, err := rdb.PFCount(ctx, "myset").Result()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
fmt.Println("set cardinality", card)
|
|
}
|