Documentation ¶
Index ¶
- func Del(key string) (resp *clientv3.DeleteResponse, err error)
- func DelWithPrefix(key string) (resp *clientv3.DeleteResponse, err error)
- func Get(key string, opts ...clientv3.OpOption) (rsp *clientv3.GetResponse, err error)
- func GetArray(key string) (data []string)
- func GetMap(key string) (data map[string]string)
- func GetString(key string) string
- func Init(configs ...Config) (err error)
- func RegisterService(key, val string) (err error)
- func Set(key, val string) (resp *clientv3.PutResponse, err error)
- func SetTTL(key, val string, ttl int64) (resp *clientv3.PutResponse, err error)
- func SetTTLWithPrevKV(key, val string, ttl int64) (resp *clientv3.PutResponse, err error)
- func SetWithPrevKV(key, val string) (resp *clientv3.PutResponse, err error)
- func Watch(key string) <-chan []string
- type Config
- type GoEtcdClient
- func (cli *GoEtcdClient) Del(key string, opts ...clientv3.OpOption) (resp *clientv3.DeleteResponse, err error)
- func (cli *GoEtcdClient) DelWithPrefix(key string) (resp *clientv3.DeleteResponse, err error)
- func (cli *GoEtcdClient) Get(key string, opts ...clientv3.OpOption) (resp *clientv3.GetResponse, err error)
- func (cli *GoEtcdClient) GetArray(key string) (data []string)
- func (cli *GoEtcdClient) GetMap(key string) (data map[string]string)
- func (cli *GoEtcdClient) GetString(key string) string
- func (cli *GoEtcdClient) RegisterService(serviceName, addr string) (err error)
- func (cli *GoEtcdClient) Set(key, val string, opts ...clientv3.OpOption) (resp *clientv3.PutResponse, err error)
- func (cli *GoEtcdClient) SetTTL(key, val string, ttl int64, opts ...clientv3.OpOption) (resp *clientv3.PutResponse, err error)
- func (cli *GoEtcdClient) SetTTLWithPrevKV(key, val string, ttl int64) (resp *clientv3.PutResponse, err error)
- func (cli *GoEtcdClient) SetWithPrevKV(key, val string) (resp *clientv3.PutResponse, err error)
- func (cli *GoEtcdClient) Watch(key string) <-chan []string
- type TLS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelWithPrefix ¶
func DelWithPrefix(key string) (resp *clientv3.DeleteResponse, err error)
func RegisterService ¶
func SetTTLWithPrevKV ¶
func SetTTLWithPrevKV(key, val string, ttl int64) (resp *clientv3.PutResponse, err error)
func SetWithPrevKV ¶
func SetWithPrevKV(key, val string) (resp *clientv3.PutResponse, err error)
Types ¶
type Config ¶
type Config struct { Endpoints []string `json:"endpoints,optional" yaml:"Endpoints,optional"` Name string `json:"name,optional" yaml:"Name,optional"` Username string `json:"username,optional" yaml:"Username,optional"` Password string `json:"password,optional" yaml:"Password,optional"` TLS *TLS `json:"tls,optional" yaml:"TLS,optional"` }
type GoEtcdClient ¶
func Default ¶
func Default() *GoEtcdClient
func GetClient ¶
func GetClient(names ...string) *GoEtcdClient
func New ¶
func New(conf Config) (cli *GoEtcdClient, err error)
func (*GoEtcdClient) Del ¶
func (cli *GoEtcdClient) Del(key string, opts ...clientv3.OpOption) (resp *clientv3.DeleteResponse, err error)
del key and return previous key-value
func (*GoEtcdClient) DelWithPrefix ¶
func (cli *GoEtcdClient) DelWithPrefix(key string) (resp *clientv3.DeleteResponse, err error)
del prefix key and return previous key-value
func (*GoEtcdClient) Get ¶
func (cli *GoEtcdClient) Get(key string, opts ...clientv3.OpOption) (resp *clientv3.GetResponse, err error)
get value by key
func (*GoEtcdClient) GetArray ¶
func (cli *GoEtcdClient) GetArray(key string) (data []string)
get array value by prefix key
func (*GoEtcdClient) GetMap ¶
func (cli *GoEtcdClient) GetMap(key string) (data map[string]string)
get map value by prefix key
func (*GoEtcdClient) GetString ¶
func (cli *GoEtcdClient) GetString(key string) string
get string value by prefix key
func (*GoEtcdClient) RegisterService ¶
func (cli *GoEtcdClient) RegisterService(serviceName, addr string) (err error)
register service and keepalive
func (*GoEtcdClient) Set ¶
func (cli *GoEtcdClient) Set(key, val string, opts ...clientv3.OpOption) (resp *clientv3.PutResponse, err error)
set key-value
func (*GoEtcdClient) SetTTL ¶
func (cli *GoEtcdClient) SetTTL(key, val string, ttl int64, opts ...clientv3.OpOption) (resp *clientv3.PutResponse, err error)
set key-value-ttl
func (*GoEtcdClient) SetTTLWithPrevKV ¶
func (cli *GoEtcdClient) SetTTLWithPrevKV(key, val string, ttl int64) (resp *clientv3.PutResponse, err error)
set key-value-ttl and return previous key-value
func (*GoEtcdClient) SetWithPrevKV ¶
func (cli *GoEtcdClient) SetWithPrevKV(key, val string) (resp *clientv3.PutResponse, err error)
set key-value and return previous key-value
func (*GoEtcdClient) Watch ¶
func (cli *GoEtcdClient) Watch(key string) <-chan []string
watch the key
Click to show internal directories.
Click to hide internal directories.