etcd

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

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
}

func New

func New(addr []string, username, password string, readTimeout, dialTimeout int) (*Client, error)

初始化etcd

func (*Client) Close

func (p *Client) Close()

关闭

func (*Client) Delete

func (p *Client) Delete(key string) error

删除数据

func (*Client) Get

func (p *Client) Get(key string) (map[string]string, error)

获取数据

func (*Client) GetKSort

func (p *Client) GetKSort(key string) ([]string, []string, error)

获取数据,按key排序

func (*Client) GetWithPrefix

func (p *Client) GetWithPrefix(prefix string) (map[string]string, error)

前缀获取数据

func (*Client) LeasePutKeep

func (p *Client) LeasePutKeep(key, val string, ttl int64) (clientv3.LeaseID, <-chan *clientv3.LeaseKeepAliveResponse, error)

put租约key val

func (*Client) Put

func (p *Client) Put(key, val string) error

写入数据

func (*Client) Watch

func (p *Client) Watch(key string, handle func(ctx context.Context, tp string, key, val []byte))

监听数据

func (*Client) WatchWithPrefix

func (p *Client) WatchWithPrefix(prefix string, handle func(ctx context.Context, tp string, key, val []byte))

前缀监听数据

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL