config

package
Version: v0.0.0-...-3a63d34 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKvsEmpty       = errors.New("kvs is empty")
	ErrInvalidKey     = errors.New("Invalid parameter: 'key' is invalid")
	ErrInvalidNpLevel = errors.New("Invalid parameter: 'namespaceLevel' is invalid")
	ErrConfigNonPtr   = errors.New("Invalid parameter: 'config' is not a pointer")
	ErrConfigPtToPtr  = errors.New("Invalid parameter: 'config' can't point to a pointer")
	ErrConfigNilPtr   = errors.New("Invalid parameter: 'config' is a nil pointer")
	ErrUnknowResult   = errors.New("unknow result type")
)

Functions

func CheckKeys

func CheckKeys(keys, keysWithPrefix []string)

func Get

func Get(key string, config interface{}) error

Get 获取配置 * key: etcd中的完整路径 * config: pointer of config struct

func GetInNamespace

func GetInNamespace(key string, config interface{}, namespaceLevel int) error

GetInNamespace 在某个namespace下获取配置 * key: namespace下的部分路径 * config: pointer of config struct * namespaceLevel: 在key之前拼接n级namespace,0等同于完整路径

func InitETCD

func InitETCD(addr string)

InitETCD 初始化etcd client,namespace * addr: username:password@addr1,addr2/namespace

func SetNamespace

func SetNamespace(path string)

func WithCustomWatch

func WithCustomWatch(key string, fs ...func())

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto