updates for breaking changes in go-micro

This commit is contained in:
Asim Aslam 2019-12-16 15:41:04 +00:00 committed by Vasiliy Tolstov
parent 7bf60f879d
commit e64808d638

View File

@ -1,13 +1,12 @@
package redis
import (
"github.com/micro/go-micro/config/options"
"github.com/micro/go-micro/store"
redis "gopkg.in/redis.v3"
)
type rkv struct {
options.Options
options store.Options
Client *redis.Client
}
@ -85,21 +84,20 @@ func (r *rkv) String() string {
return "redis"
}
func NewStore(opts ...options.Option) store.Store {
options := options.NewOptions(opts...)
var nodes []string
if n, ok := options.Values().Get("store.nodes"); ok {
nodes = n.([]string)
func NewStore(opts ...store.Option) store.Store {
var options store.Options
for _, o := range opts {
o(&options)
}
nodes := options.Nodes
if len(nodes) == 0 {
nodes = []string{"127.0.0.1:6379"}
}
return &rkv{
Options: options,
options: options,
Client: redis.NewClient(&redis.Options{
Addr: nodes[0],
Password: "", // no password set