config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	// 如果path是以/结尾,则是目录,否则当作key处理
	Subscribe(path string) Watcher
	Get(ctx context.Context, path string) []Spec
}

Config is config interface

type Data

type Data interface {
	Unmarshal(interface{}) error
	Raw() []byte
}

type Spec

type Spec struct {
	Key  string
	Data Data
}

type Watcher

type Watcher interface {
	// Watch 第一次访问的时候如果有值则立马返回spec;后面watch的时候有变更才返回
	// 如果不传key则watch整个文件变动
	// 如果超时或者Watcher被Close应当抛出错误
	Watch(ctx context.Context) ([]Spec, error)
	Close()
}

Watcher is topic watch

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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