configor

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(n string, b Builder)

Types

type Builder

type Builder interface {
	Build() Configor
}

func Lookup

func Lookup(n string) Builder

type Config

type Config struct {
	Name    string `json:"name,omitempty"`
	Payload []byte `json:"payload,omitempty"`
}

type Configor

type Configor interface {
	Watch(context.Context, Handler, ...string) error
	Load(context.Context, ...string) (map[string][]byte, error)
}

func NewFileConfigor

func NewFileConfigor() Configor

type Event

type Event string
const (
	ADD Event = "add"
	DEL Event = "del"
	CHG Event = "chg"
	SYS Event = "SYS"
)

type FileConfigor

type FileConfigor struct{}

func (*FileConfigor) Load

func (fc *FileConfigor) Load(ctx context.Context, paths ...string) (map[string][]byte, error)

func (*FileConfigor) Watch

func (fc *FileConfigor) Watch(ctx context.Context, handler Handler, paths ...string) error

type FileConfigorBuilder

type FileConfigorBuilder struct{}

func (FileConfigorBuilder) Build

func (FileConfigorBuilder) Build() Configor

type Handler

type Handler interface {
	OnChange(Event, Config, error)
}

Jump to

Keyboard shortcuts

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