multiconfig

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeError added in v0.2.0

func MergeError(err error, item ItemInterface) error

MergeError is for when a required attribute is empty

Types

type ItemInterface added in v0.2.0

type ItemInterface interface {
	Key() string
	ToBodyMap() (common.BodyMap, error)
}

ItemInterface is the interface for a config map, providing the methods needed to sort a set of configs, as well as for extracting the BodyMap (for merging, later)

type Map added in v0.2.0

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

Map is the type of config list. This is a list of sort-keys associated to a config item (i.e. ItemInterface)

func New

func New() *Map

New struct

func (*Map) AddItem added in v0.2.0

func (s *Map) AddItem(item ...ItemInterface) *Map

AddItem is for adding another item to the config list.

func (*Map) Items added in v0.2.0

func (s *Map) Items() []ItemInterface

Items returns a copy of the current config items.

func (*Map) Len added in v0.2.0

func (s *Map) Len() int

Len is part of sort.Interface.

func (*Map) Less added in v0.2.0

func (s *Map) Less(i, j int) bool

Less is part of sort.Interface.

func (*Map) Merge added in v0.2.0

func (s *Map) Merge() (common.BodyMap, error)

Merge all the BodyMap's provided into a single BodyMap, return a new BodyMap.

They are combined by first lexically-ordering all the configs with the Sorted() method, then merging thme together in lexical-order -- whereby the later keys in a BodyMap will override earlier ones.

i.e. a BodyMap with a Key() of "z..." will be merged-in after those with a Key() of "a..."

func (*Map) Sorted added in v0.2.0

func (s *Map) Sorted() *Map

Sorted returns sorted _copy_ of the Map.

func (*Map) Swap added in v0.2.0

func (s *Map) Swap(i, j int)

Swap is part of sort.Interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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