Tree is a structured representation of a string keyed tree document such as yaml or json.
type Tree map[string]interface{}
func BytesToTree(bytes []byte) (Tree, error)
BytesToTree converts given bytes into a tree by Unmarshaling
func Diff(x interface{}, y interface{}) (Tree, error)
Diff marshals two objects into their yaml representations and then performs a diff on those Trees. It returns a Tree which represents all of the fields in y which differ from x.
func MarshalToTree(obj interface{}) (Tree, error)
MarshalToTree marshals obj to yaml and then parses the resulting yaml as a Tree.
func (t Tree) Diff(other Tree) (Tree, error)
Diff returns the subset of other where its values differ from t.
func (t Tree) Empty() bool
Empty returns true iff the Tree contains no leaf values.
func (t Tree) GetString(path ...string) (string, error)
GetString returns the string value at the given path
func (t Tree) Prune()
Prune removes all empty subtrees. A subtree is considered empty if it does not contain any leaf values.
func (t Tree) String() string
String returns a yaml representation of the Tree or an error string if serialization fails.
func (t Tree) ToYAML() (string, error)
ToYAML returns a yaml serialization of the Tree.