merge

package
Version: v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMapping added in v1.3.1

func IsMapping(i interface{}) bool

IsMapping reports whether a type is a mapping in YAML, represented as a map[interface{}]interface{}.

func IsScalar added in v1.3.1

func IsScalar(i interface{}) bool

IsScalar reports whether a type is a scalar value in YAML.

func IsSequence added in v1.3.1

func IsSequence(i interface{}) bool

IsSequence reports whether a type is a sequence in YAML, represented as an []interface{}.

func YAML

func YAML(sources [][]byte, strict bool) (*bytes.Buffer, error)

YAML deep-merges any number of YAML sources, with later sources taking priority over earlier ones.

Maps are deep-merged. For example,

{"one": 1, "two": 2} + {"one": 42, "three": 3}
== {"one": 42, "two": 2, "three": 3}

Sequences are replaced. For example,

{"foo": [1, 2, 3]} + {"foo": [4, 5, 6]}
== {"foo": [4, 5, 6]}

In non-strict mode, duplicate map keys are allowed within a single source, with later values overwriting previous ones. Attempting to merge mismatched types (e.g., merging a sequence into a map) replaces the old value with the new.

Enabling strict mode returns errors in both of the above cases.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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