Xiang Li d3fbf6d997 bump 3rd party hace 12 años
..
etcd d3fbf6d997 bump 3rd party hace 12 años
examples cf2d6888c2 add error package hace 12 años
LICENSE 6813a92325 bump(github.com/coreos/go-etcd): 9d174bd052fc49e53d5978c2ecd81770aee3788d hace 12 años
README.md d3fbf6d997 bump 3rd party hace 12 años

README.md

go-etcd

golang client library for etcd

This etcd client library is under heavy development. Check back soon for more docs. In the meantime, check out etcd for details on the client protocol.

For usage see example below or look at godoc: go-etcd/etcd

Install

go get github.com/coreos/go-etcd/etcd

Examples

Returning error values are not showed for the sake of simplicity, but you should check them.

package main

import (
	"fmt"
	"github.com/coreos/go-etcd/etcd"
)

func main() {
	c := etcd.NewClient() // default binds to http://0.0.0.0:4001

	// SET the value "bar" to the key "foo" with zero TTL
	// returns a: *store.Response
	res, _ := c.Set("foo", "bar", 0)
	fmt.Printf("set response: %+v\n", res)

	// GET the value that is stored for the key "foo"
	// return a slice: []*store.Response
	values, _ := c.Get("foo")
	for i, res := range values { // .. and print them out
		fmt.Printf("[%d] get response: %+v\n", i, res)
	}

	// DELETE the key "foo"
	// returns a: *store.Response
	res, _ = c.Delete("foo")
	fmt.Printf("delete response: %+v\n", res)
}