Documentation
¶
Index ¶
- func CompareActions(current, next plans.Action) plans.Action
- func ProcessSlice[Input any](before, after []Input, process ProcessIndices, ...)
- func TransformMap[Input any](before, after map[string]Input, keys []string, process ProcessKey) (map[string]computed.Diff, plans.Action)
- func TransformSlice[Input any](before, after []Input, process TransformIndices, ...) ([]computed.Diff, plans.Action)
- type ProcessIndices
- type ProcessKey
- type ShouldDiffElement
- type TransformIndices
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareActions ¶
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 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)