dynconf

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 9 Imported by: 0

README

dynconf

GoDoc Build Status Coverage Status

Dynamic configuration for Go

Requirements

  • Go 1.13

Documentation

Overview

Package dynconf implements dynamic configuration.

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("dynconf: key not found")

ErrKeyNotFound is returned when a key has not been found.

Functions

This section is empty.

Types

type Value

type Value interface {
	// Unmarshal unmarshals the value from the given data.
	Unmarshal(data []byte) (err error)

	// String returns a string representing the value.
	String() string
}

Value represents a structured value of a key.

type ValueFactory

type ValueFactory func() Value

ValueFactory is the type of the function returning a new value.

type ValueOutdatedCallback

type ValueOutdatedCallback interface {
	// OnOutdated is called once after the value, as the latest value,
	// has been replaced with another value.
	OnOutdated()
}

ValueOutdatedCallback represents an optional callback to Value.

type ValueWatchRemovedCallback

type ValueWatchRemovedCallback interface {
	// OnWatchRemoved is called once after the watch has been removed,
	// which is set on the key for the value.
	OnWatchRemoved()
}

ValueWatchRemovedCallback represents an optional callback to Value.

type Watch

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

Watch presents a watch on a key.

func (*Watch) Key

func (w *Watch) Key() string

Key returns the key on which the watch is set.

func (*Watch) Remove

func (w *Watch) Remove()

Remove removes the watch.

func (*Watch) Value

func (w *Watch) Value() Value

Value returns the latest value of the key on which the watch is set.

type Watcher

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

Watcher presents a watcher for dynamic configuration.

func (*Watcher) AddWatch

func (w *Watcher) AddWatch(ctx context.Context, key string, valueFactory ValueFactory) (*Watch, error)

AddWatch adds a watch on the given key and then returns the watch.

func (*Watcher) Init

func (w *Watcher) Init(client *api.Client, logger *zerolog.Logger) *Watcher

Init initialize the watcher and then returns the watcher.

Jump to

Keyboard shortcuts

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