merge

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package merge provides generic helpers for merging slices by identity key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByKey

func ByKey[T any](base, custom []T, keyFn func(T) string, onCollide func(base, custom T) T) []T

ByKey merges two slices by identity key. For entries with a non-empty key (returned by keyFn), a custom entry that shares a key with a base entry triggers onCollide(base, custom); the return value replaces the base entry. Custom entries with no matching base key are appended. Non-keyed entries (empty key) are always appended. Duplicate keys within custom are collapsed; the first occurrence takes effect.

Types

This section is empty.

Jump to

Keyboard shortcuts

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