settings

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPrefix

func WithPrefix(prefix string) func(*Options)

WithPrefix adds the given prefix when loading settings

Types

type Options

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

Options contains loading options for settings

type Settings

type Settings map[string]interface{}

Settings represents a settings map

func FromFlatten

func FromFlatten(m map[string]string) (Settings, error)

FromFlatten takes a flatten map and loads it as a Settings map This uses yaml.Unmarshal to "guess" the type of the value

func Load

func Load(data []byte, ops ...func(*Options)) (Settings, error)

Load loads the given data in settings

func LoadFile

func LoadFile(path string, ops ...func(*Options)) (Settings, error)

LoadFile loads a file (path) in settings (i.e. flatten map)

func LoadFiles

func LoadFiles(paths []string, ops ...func(*Options)) (Settings, error)

LoadFiles loads multiple path in settings, merging them.

func LoadMultiple

func LoadMultiple(datas [][]byte, ops ...func(*Options)) (Settings, error)

LoadMultiple loads multiple data in settings

func Merge

func Merge(settings ...Settings) (Settings, error)

Merge merges multiple settings overriding duplicated keys

func (Settings) Flatten

func (s Settings) Flatten() map[string]string

Flatten returns a flatten view of a settings This becomes a one-level map with keys joined with a dot

Jump to

Keyboard shortcuts

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