From e64808d63874c00ff0d7950c7d9dd69a1dd10afd Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 16 Dec 2019 15:41:04 +0000 Subject: [PATCH] updates for breaking changes in go-micro --- redis.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/redis.go b/redis.go index e66f6ae..079f924 100644 --- a/redis.go +++ b/redis.go @@ -1,14 +1,13 @@ 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 - Client *redis.Client + options store.Options + Client *redis.Client } func (r *rkv) Read(keys ...string) ([]*store.Record, error) { @@ -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