mergekey

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mergekey implements the default Merge-Key algorithm. It is independent of node representation and value construction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge[T any](groups [][]Entry[T], conflicts string) ([]T, error)

Merge selects entries from the target followed by the ordered sources. Ordinary duplicates within one mapping retain their original order.

Types

type Config

type Config struct {
	Disable   bool
	Multiple  string
	Conflicts string
}

Config controls recognition, repeated directives, and merge conflicts. Empty Multiple inherits the loader's duplicate-key setting. Empty Conflicts means first.

func (Config) Validate

func (c Config) Validate() error

Validate checks a configuration without changing it.

type ConflictError

type ConflictError struct {
	Key   any
	Group int
	Index int
}

ConflictError identifies the later entry in an overlap between mappings.

func (*ConflictError) Error

func (e *ConflictError) Error() string

type Entry

type Entry[T any] struct {
	Key   any
	Value T
}

Entry associates a constructed key with a host-owned mapping entry.

Jump to

Keyboard shortcuts

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