settings

package
Version: v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

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