Skip to content

Commit 409dee9

Browse files
committed
docs: update example
1 parent 56d54a2 commit 409dee9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

readme.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,18 @@ import (
4444
)
4545

4646
func main() {
47-
addr := "localhost:8500"
47+
ctx := context.Background()
4848

49-
// Initialize a new store.
5049
config := &consul.Config{
5150
ConnectionTimeout: 10 * time.Second,
5251
}
5352

54-
kv, err := valkeyrie.NewStore(consul.StoreName, []string{addr}, config)
53+
kv, err := valkeyrie.NewStore(ctx, consul.StoreName, []string{"localhost:8500"}, config)
5554
if err != nil {
5655
log.Fatal("Cannot create store")
5756
}
5857

5958
key := "foo"
60-
ctx := context.Background()
6159

6260
err = kv.Put(ctx, key, []byte("bar"), nil)
6361
if err != nil {
@@ -69,11 +67,11 @@ func main() {
6967
log.Fatalf("Error trying accessing value at key: %v", key)
7068
}
7169

70+
log.Printf("value: %s", string(pair.Value))
71+
7272
err = kv.Delete(ctx, key)
7373
if err != nil {
7474
log.Fatalf("Error trying to delete key %v", key)
7575
}
76-
77-
log.Printf("value: %s", string(pair.Value))
7876
}
7977
```

0 commit comments

Comments
 (0)