config

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Toml = "toml"
	Yaml = "yaml"
	Json = "json"
)
View Source
const (
	DefaultDir = "config"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMate

type ConfigMate interface {
	PrimitiveDecode(vals ...ConfigureMatcher) error
}

func NewConfig

func NewConfig(opts ...Option) ConfigMate

func NewDefaultConfig

func NewDefaultConfig() ConfigMate

type ConfigWithToml

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

func (*ConfigWithToml) Decode

func (ct *ConfigWithToml) Decode(dir string) error

func (*ConfigWithToml) PrimitiveDecode

func (ct *ConfigWithToml) PrimitiveDecode(vals ...ConfigureMatcher) error

type Configuration

type Configuration interface {
	Decode(dir string) error
}

type ConfigureMatcher

type ConfigureMatcher interface {
	Name() string
}

type KeyValue added in v1.5.4

type KeyValue struct {
	Key    string
	Value  []byte
	Format string
}

type Option added in v1.5.4

type Option func(opt *option)

func WithConfigDir added in v1.5.4

func WithConfigDir(dir string) Option

func WithConfiguration added in v1.5.4

func WithConfiguration(cfg Configuration) Option

type Source added in v1.5.4

type Source interface {
	Load() ([]*KeyValue, error)
	Watch() (Watcher, error)
}

Source is config source.

type Watcher added in v1.5.4

type Watcher interface {
	Next() ([]*KeyValue, error)
	Stop() error
}

Watcher watches a source for changes.

Jump to

Keyboard shortcuts

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