Skip to content

Commit

Permalink
Merge a611b74 into 93ab0e6
Browse files Browse the repository at this point in the history
  • Loading branch information
guotie authored Dec 11, 2017
2 parents 93ab0e6 + a611b74 commit a65cf7b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Examples
# Examples

This document contains useful example of usage for `libkv`. It might not be complete but provides with general informations on how to use the client.

##Create a store and use Put/Get/Delete
## Create a store and use Put/Get/Delete

```go
package main
Expand Down Expand Up @@ -62,7 +62,7 @@ func main() {
}
```

##List keys
## List keys

```go
// List will list all the keys under `key` if it contains a set of child keys/values
Expand All @@ -73,7 +73,7 @@ for _, pair := range entries {

```

##Watching for events on a single key (Watch)
## Watching for events on a single key (Watch)

You can use watches to watch modifications on a key. First you need to check if the key exists. If this is not the case, we need to create it using the `Put` function.

Expand All @@ -97,7 +97,7 @@ select {

```

##Watching for events happening on child keys (WatchTree)
## Watching for events happening on child keys (WatchTree)

You can use watches to watch modifications on a key. First you need to check if the key exists. If this is not the case, we need to create it using the `Put` function. There is a special step here though if you want your code to work across backends. Because `etcd` is a special case and it makes the distinction between directories and keys, we need to make sure that the created key is considered as a directory by enforcing `IsDir` at `true`.

Expand Down Expand Up @@ -154,4 +154,4 @@ err = lock.Unlock()
if err != nil {
fmt.Errorf("something went wrong when trying to unlock key %v", key)
}
```
```

0 comments on commit a65cf7b

Please sign in to comment.