From a611b74ad13d2a3f516cb2bf609409ae1a9f0bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=81=E5=93=A5?= Date: Mon, 11 Dec 2017 11:18:11 +0800 Subject: [PATCH] Update examples.md Signed-off-by: guotie --- docs/examples.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index 09752db1..232ef0ec 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -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 @@ -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 @@ -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. @@ -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`. @@ -154,4 +154,4 @@ err = lock.Unlock() if err != nil { fmt.Errorf("something went wrong when trying to unlock key %v", key) } -``` \ No newline at end of file +```