https://github.com/ashcrow/consuloretcd
A simplistic key/value abstraction for use with Consul and Etcd.
https://github.com/ashcrow/consuloretcd
Last synced: 2 months ago
JSON representation
A simplistic key/value abstraction for use with Consul and Etcd.
- Host: GitHub
- URL: https://github.com/ashcrow/consuloretcd
- Owner: ashcrow
- License: mit
- Created: 2015-03-07T22:52:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-16T11:14:42.000Z (almost 10 years ago)
- Last Synced: 2025-02-13T18:34:44.982Z (4 months ago)
- Language: Go
- Size: 206 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# consuloretcd
A simplistic key/value abstraction for use with Consul and Etcd.
**Warning**: This needs a lot of cleaning up and code consolidation.
**Warning**: The api will probably change a lot.
## Install
```bash
go get gopkg.in/ashcrow/consuloretcd.v1
```
## License
MIT. See LICENSE.## Features
* Consistent key/value API
* Consistent TTL support## Documentation
Read the docs at godoc: http://godoc.org/github.com/ashcrow/consuloretcd## Example
```go
package mainimport (
"fmt"
"gopkg.in/ashcrow/consuloretcd.v1"
"net/http"
)// Example
func main() {
// You must provide and http.Client
client := http.Client{}// Consul example. Replace "consul" with "etcd" to use etcd.
consul, _ := consuloretcd.NewClient(
"consul",
consuloretcd.ConsulDefaultConfig)// Get a key in consul
consul_res1, _ := consul.GetKey("test", KeyOptions{})
fmt.Println(consul_res1)// Set a key in consul
consul_res2, _ := consul.PutKey("test", "saa", KeyOptions{})
fmt.Println(consul_res2)// Delete a key in consul
if err := consul.DeleteKey("test", KeyOptions{}); err != nil {
fmt.Println(err)
}
}