Documentation
¶
Index ¶
- Constants
- func Merge(atmosConfig *schema.AtmosConfiguration, inputs []map[string]any) (map[string]any, error)
- func MergeWithContext(atmosConfig *schema.AtmosConfiguration, inputs []map[string]any, ...) (map[string]any, error)
- func MergeWithOptions(atmosConfig *schema.AtmosConfiguration, inputs []map[string]any, ...) (map[string]any, error)
- func MergeWithOptionsAndContext(atmosConfig *schema.AtmosConfiguration, inputs []map[string]any, ...) (map[string]any, error)
- type MergeContext
- func (mc *MergeContext) Clone() *MergeContext
- func (mc *MergeContext) FormatError(err error, additionalInfo ...string) error
- func (mc *MergeContext) GetDepth() int
- func (mc *MergeContext) GetImportChainString() string
- func (mc *MergeContext) HasFile(filePath string) bool
- func (mc *MergeContext) WithFile(filePath string) *MergeContext
Constants ¶
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.