Documentation ¶
Index ¶
- type Client
- func (e *Client) Close() error
- func (e *Client) Create(ctx context.Context, key string, val string, opts []clientv3.OpOption) error
- func (e *Client) Delete(ctx context.Context, key string, withPrefix bool) error
- func (e *Client) Get(ctx context.Context, key string) ([]byte, error)
- func (e *Client) List(ctx context.Context, key string) (*Node, error)
- func (e *Client) Update(ctx context.Context, key string, val string, ttl int64) error
- func (e *Client) UpdateOrCreate(ctx context.Context, key string, val string, ttl int64) error
- func (e *Client) Watch(ctx context.Context, prefix string) clientv3.WatchChan
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapped etcd client that support some simple method
func NewClientFromCfg ¶
func NewClientFromCfg(endpoints []string, dialTimeout time.Duration, root string, security *tls.Config) (*Client, error)
NewClientFromCfg returns a wrapped etcd client
func (*Client) Create ¶
func (e *Client) Create(ctx context.Context, key string, val string, opts []clientv3.OpOption) error
Create guarantees to set a key = value with some options(like ttl)
func (*Client) List ¶
List returns the trie struct that constructed by the key/value with same prefix
func (*Client) UpdateOrCreate ¶
UpdateOrCreate updates a key/value, if the key does not exist then create, or update
Click to show internal directories.
Click to hide internal directories.