Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document possible integration with miniredis for unit testing #787

Open
piotr-srebniak-limango opened this issue Jun 9, 2018 · 1 comment
Open

Comments

@piotr-srebniak-limango
Copy link

@piotr-srebniak-limango piotr-srebniak-limango commented Jun 9, 2018

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)
}

@vmihailenco
Copy link
Member

@vmihailenco vmihailenco commented Jun 9, 2018

Sounds good - do you want to send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.