collections

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareActions

func CompareActions(current, next plans.Action) plans.Action

CompareActions will compare current and next, and return plans.Update if they are different, and current if they are the same.

func ProcessSlice

func ProcessSlice[Input any](before, after []Input, process ProcessIndices, shouldDiffElement ShouldDiffElement[Input])

ProcessSlice compares two slices and returns a slice of computed.Diff, this function handles everything TransformSlice does, other than determining the operation. Uses TransformIndices function to create the computed.Diff for each element based on their type. ShouldDiffElement argument is used to determine if before and after elements should be 'diffed' with each other instead of marking the old element as deleted and the new element as created. ShouldDiffElement argument is primarily useful to provide detailed differences for Object types and strings with multiple lines.

func TransformMap

func TransformMap[Input any](before, after map[string]Input, keys []string, process ProcessKey) (map[string]computed.Diff, plans.Action)

func TransformSlice

func TransformSlice[Input any](before, after []Input, process TransformIndices, shouldDiffElement ShouldDiffElement[Input]) ([]computed.Diff, plans.Action)

TransformSlice compares two slices and returns a slice of computed.Diff and the action that was taken for the entire slice. This function calls ProcessSlice to process the elements in the slices, which in turn uses the TransformIndices function to create the computed.Diff for each element based on their type. ShouldDiffElement argument is used to determine if before and after elements should be 'diffed' with each other instead of marking the old element as deleted and the new element as created. ShouldDiffElement argument is primarily useful to provide detailed differences for Object types and strings with multiple lines. It is called for each element in the both slices.

Types

type ProcessIndices

type ProcessIndices func(before, after int)

type ProcessKey

type ProcessKey func(key string) computed.Diff

type ShouldDiffElement

type ShouldDiffElement[Input any] func(inputA, inputB Input) bool

type TransformIndices

type TransformIndices func(before, after int) computed.Diff

Jump to

Keyboard shortcuts

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