merge

package
v1.193.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListMergeStrategyReplace = "replace"
	ListMergeStrategyAppend  = "append"
	ListMergeStrategyMerge   = "merge"
)

Variables

This section is empty.

Functions

func Merge

func Merge(
	atmosConfig *schema.AtmosConfiguration,
	inputs []map[string]any,
) (map[string]any, error)

Merge takes a list of maps as input, deep-merges the items in the order they are defined in the list, and returns a single map with the merged contents.

func MergeWithContext added in v1.191.0

func MergeWithContext(
	atmosConfig *schema.AtmosConfiguration,
	inputs []map[string]any,
	context *MergeContext,
) (map[string]any, error)

MergeWithContext performs a merge operation with file context tracking for better error messages.

func MergeWithOptions added in v1.3.1

func MergeWithOptions(
	atmosConfig *schema.AtmosConfiguration,
	inputs []map[string]any,
	appendSlice bool,
	sliceDeepCopy bool,
) (map[string]any, error)

MergeWithOptions takes a list of maps and options as input, deep-merges the items in the order they are defined in the list, and returns a single map with the merged contents.

func MergeWithOptionsAndContext added in v1.191.0

func MergeWithOptionsAndContext(
	atmosConfig *schema.AtmosConfiguration,
	inputs []map[string]any,
	appendSlice bool,
	sliceDeepCopy bool,
	context *MergeContext,
) (map[string]any, error)

MergeWithOptionsAndContext performs merge with options and context tracking.

Types

type MergeContext added in v1.191.0

type MergeContext struct {
	// CurrentFile is the file currently being processed.
	CurrentFile string

	// ImportChain tracks the chain of imports leading to the current file.
	// The first element is the root file, the last is the current file.
	ImportChain []string

	// ParentContext is the parent merge context for nested operations.
	ParentContext *MergeContext
}

MergeContext tracks file paths and import chains during merge operations to provide better error messages when merge conflicts occur.

func NewMergeContext added in v1.191.0

func NewMergeContext() *MergeContext

NewMergeContext creates a new merge context.

func (*MergeContext) Clone added in v1.191.0

func (mc *MergeContext) Clone() *MergeContext

Clone creates a copy of the merge context.

func (*MergeContext) FormatError added in v1.191.0

func (mc *MergeContext) FormatError(err error, additionalInfo ...string) error

FormatError formats an error with merge context information.

func (*MergeContext) GetDepth added in v1.191.0

func (mc *MergeContext) GetDepth() int

GetDepth returns the depth of the import chain.

func (*MergeContext) GetImportChainString added in v1.191.0

func (mc *MergeContext) GetImportChainString() string

GetImportChainString returns a formatted string of the import chain.

func (*MergeContext) HasFile added in v1.191.0

func (mc *MergeContext) HasFile(filePath string) bool

HasFile checks if a file is already in the import chain (to detect circular imports).

func (*MergeContext) WithFile added in v1.191.0

func (mc *MergeContext) WithFile(filePath string) *MergeContext

WithFile creates a new context for processing a specific file.

Jump to

Keyboard shortcuts

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