Documentation
¶
Overview ¶
Package diffmap computes the change-set that would turn map [a] into map [b].
A change-set is itself a [map[string]any] that contains only the keys that differ. Added keys get their new value, removed keys get a nil value, and modified nested-maps are expressed recursively.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(dst, chg DiffMap)
Apply mutates [dst] so that, after the call, [dst] equals the map that originally produced the given change-set `chg`.
dst := map[string]any{"a": 1, "b": map[string]any{"c": false}}
chg := map[string]any{"b": map[string]any{"c": true}}
diffmap.Apply(dst, chg) // dst is now {"a":1,"b":{"c":true}}
Types ¶
Click to show internal directories.
Click to hide internal directories.