Documentation
¶
Index ¶
- type Diff
- type DiffKey
- type DiffOption
- func WithBoolDiff(old, new bool) DiffOption
- func WithChildren(children ...*Diff) DiffOption
- func WithContentDiff(old, new string) DiffOption
- func WithKey(key string) DiffOption
- func WithOptionalBoolDiff(old, new *bool) DiffOption
- func WithOptionalStringDiff(old, new *string) DiffOption
- func WithResourceID(id NodeID) DiffOption
- func WithStringDiff(old, new string) DiffOption
- func WithStringSliceDiff(old, new []string) DiffOption
- type DiffSummary
- type Diffable
- type Edge
- type EdgeReason
- type Graph
- type ImpactReason
- type NodeID
- type Op
- type StringDiffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
type Diff struct {
Key string `json:"key"`
ResourceID NodeID `json:"resource_id,omitempty"`
Diff *DiffKey `json:"diff,omitempty"`
Children []*Diff `json:"children,omitempty"`
Impacted bool `json:"impacted,omitempty"`
ImpactReasons []ImpactReason `json:"impact_reasons,omitempty"`
}
func MapDiff ¶ added in v0.19.1012
MapDiff diffs two map[string]string values, returning a parent node with per-key children. Returns nil if both maps are empty/nil.
func NewDiff ¶
func NewDiff(opts ...DiffOption) *Diff
func (*Diff) ApplyImpacts ¶ added in v0.19.1188
func (d *Diff) ApplyImpacts(impacts map[NodeID][]ImpactReason)
ApplyImpacts annotates resource nodes in the tree with propagated graph impacts. It leaves their direct Diff operations unchanged.
func (*Diff) DirectSummary ¶ added in v0.19.1188
func (d *Diff) DirectSummary() DiffSummary
DirectSummary ignores dependency impacts and reports only value changes.
func (*Diff) FindResource ¶ added in v0.19.1188
func (*Diff) FormatChanged ¶ added in v0.19.1012
FormatChanged returns only the parts of the diff tree that have changes (added, removed, or changed). Unchanged fields and sections are omitted entirely.
func (*Diff) String ¶
String returns the full diff tree with +/-/~ prefixes indicating added, removed, changed, and unchanged fields. Empty unchanged fields (both old and new are "") are suppressed.
func (*Diff) Summary ¶
func (d *Diff) Summary() DiffSummary
type DiffOption ¶
type DiffOption func(*Diff)
func WithBoolDiff ¶ added in v0.19.1012
func WithBoolDiff(old, new bool) DiffOption
WithBoolDiff creates a DiffOption that compares two bool values.
func WithChildren ¶
func WithChildren(children ...*Diff) DiffOption
func WithContentDiff ¶ added in v0.19.1024
func WithContentDiff(old, new string) DiffOption
WithContentDiff creates a DiffOption for file-like content. It derives the op from presence (add when old is empty, remove when new is empty, change otherwise), stores a short label in Diff for text renderers, and carries the raw before/after contents so consumers can render a line-by-line diff.
func WithKey ¶
func WithKey(key string) DiffOption
func WithOptionalBoolDiff ¶ added in v0.19.1012
func WithOptionalBoolDiff(old, new *bool) DiffOption
WithOptionalBoolDiff creates a DiffOption that compares two *bool values, treating nil as false.
func WithOptionalStringDiff ¶ added in v0.19.1012
func WithOptionalStringDiff(old, new *string) DiffOption
WithOptionalStringDiff creates a DiffOption that compares two *string values, treating nil as empty string.
func WithResourceID ¶ added in v0.19.1188
func WithResourceID(id NodeID) DiffOption
func WithStringDiff ¶
func WithStringDiff(old, new string) DiffOption
func WithStringSliceDiff ¶ added in v0.19.1012
func WithStringSliceDiff(old, new []string) DiffOption
WithStringSliceDiff creates a DiffOption that compares two string slices by sorting and joining them.
type DiffSummary ¶
type Edge ¶ added in v0.19.1188
type Edge struct {
Dependent NodeID `json:"dependent"`
Dependency NodeID `json:"dependency"`
Reason EdgeReason `json:"reason"`
}
type EdgeReason ¶ added in v0.19.1188
type EdgeReason string
const ( EdgeReasonComponentDependency EdgeReason = "component_dependency" EdgeReasonComponentReference EdgeReason = "component_reference" EdgeReasonInputReference EdgeReason = "input_reference" EdgeReasonInstallStackOutput EdgeReason = "install_stack_output" EdgeReasonOperationRole EdgeReason = "operation_role" EdgeReasonSandboxOutput EdgeReason = "sandbox_output" EdgeReasonSecretReference EdgeReason = "secret_reference" EdgeReasonStackRender EdgeReason = "stack_render" )
type Graph ¶ added in v0.19.1188
type Graph struct {
// contains filtered or unexported fields
}
func (*Graph) AddDependency ¶ added in v0.19.1188
func (g *Graph) AddDependency(dependent, dependency NodeID, reason EdgeReason)
AddDependency records that dependent consumes dependency. Changes propagate in the reverse direction, from dependency to dependent.
type ImpactReason ¶ added in v0.19.1188
type ImpactReason struct {
From NodeID `json:"from"`
Edge EdgeReason `json:"edge"`
}
type StringDiffer ¶
type StringDiffer struct {
// contains filtered or unexported fields
}
func (*StringDiffer) Diff ¶
func (d *StringDiffer) Diff() (string, Op)