go-redis
go-redis copied to clipboard
Document possible integration with miniredis for unit testing
Library can be easily used with miniredis for unit testing.
I think it's worth mentioning in Readme
Example:
package main
import (
"github.com/alicebob/miniredis"
"github.com/go-redis/redis"
"fmt"
"os"
)
func main() {
mini, err := miniredis.Run()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
goredis := redis.NewClient(&redis.Options{
Addr:mini.Addr(),
})
fmt.Println(mini.Addr())
data, err := goredis.Set("test", "Zażółć gęślą jaźń", 0).Result()
fmt.Println(data, err)
resp, err := goredis.Get("test").Result()
fmt.Println(resp, err)
}
Sounds good - do you want to send a PR?
This is neat, and very helpful. I'll try to get to prepare a PR for this in a few days. Thanks @piotr-srebniak-limango
This issue is marked stale. It will be closed in 30 days if it is not updated.