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

Update examples.md #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
```
```