util_cfg_merge

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeMaps

func MergeMaps(
	base map[string]any,
	overlay map[string]any,
	configs ...MergeConfig,
) map[string]any

MergeMaps This only works with basic builtin types - NOT with structs or pointers inside the maps

Types

type MergeConfig

type MergeConfig struct {
	SliceStrategy  SliceStrategy
	SliceMergeKeys []string
}

type SliceStrategy

type SliceStrategy string
const (
	SliceStrategyAppendNoDuplicates      SliceStrategy = "append-no-duplicates"       // default: append the new slice to the original slice, but ignore duplicates
	SliceStrategyAppend                  SliceStrategy = "append"                     // append the new slice to the original slice
	SliceStrategyTruncateAndReplace      SliceStrategy = "replace"                    // replace the original slice with the new slice
	SliceStrategyMergeOverlapReplaceRest SliceStrategy = "merge-overlap-replace-rest" // replace the original slice with the new slice
)

Jump to

Keyboard shortcuts

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