add option to choose prepend/append in merge

This commit is contained in:
Donny Xia
2020-09-28 16:17:50 -07:00
parent fafe24c9df
commit 74d0d7960e
35 changed files with 592 additions and 176 deletions

View File

@@ -247,3 +247,18 @@ func String(node *yaml.Node, opts ...string) (string, error) {
}
return val, errors.Wrap(err)
}
// MergeOptionsListIncreaseDirection is the type of list growth in merge
type MergeOptionsListIncreaseDirection int
const (
MergeOptionsListAppend MergeOptionsListIncreaseDirection = iota
MergeOptionsListPrepend
)
// MergeOptions is a struct which contains the options for merge
type MergeOptions struct {
// ListIncreaseDirection indicates should merge function prepend the items from
// source list to destination or append.
ListIncreaseDirection MergeOptionsListIncreaseDirection
}