David Fisher 951d467917 Swith to coreos/go-log from ccding/go-logging пре 12 година
..
etcd 951d467917 Swith to coreos/go-log from ccding/go-logging пре 12 година
examples cf2d6888c2 add error package пре 12 година
LICENSE 6813a92325 bump(github.com/coreos/go-etcd): 9d174bd052fc49e53d5978c2ecd81770aee3788d пре 12 година
README.md d3fbf6d997 bump 3rd party пре 12 година

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)
}