consul

package
v0.0.0-...-9c04300 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key not found")

Functions

func ParsePairs

func ParsePairs(prefix string, pairs api.KVPairs, receiver interface{}, strict bool) error

将键值对列表序列化成字典 字典的key为键值对的key去掉前缀后的值 当strict参数为true时, 序列化失败键值对值时会返回错误

Types

type Consul

type Consul struct {
	*api.Client
	// contains filtered or unexported fields
}

func New

func New(addr string) (*Consul, error)

func (*Consul) KV

func (c *Consul) KV() *KV

func (*Consul) Watcher

func (c *Consul) Watcher() *Watcher

type KV

type KV struct {
	*api.KV
}

func (*KV) Delete

func (kv *KV) Delete(key string) error

删除键值对

func (*KV) Load

func (kv *KV) Load(key string, value interface{}) error

获取键值对

func (*KV) Loads

func (kv *KV) Loads(prefix string, receiver interface{}, strict bool) error

获取前缀下的所有键值对

func (*KV) Store

func (kv *KV) Store(key string, value interface{}) error

存储键值对

type Plan

type Plan struct {
	// contains filtered or unexported fields
}

func (*Plan) Run

func (p *Plan) Run() error

func (*Plan) Stop

func (p *Plan) Stop()

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func (*Watcher) Prefix

func (w *Watcher) Prefix(prefix string, handler watch.HandlerFunc) (*Plan, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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