Documentation
¶
Index ¶
- type Change
- type ChangeOperation
- type DiffFormat
- type DiffOptions
- type DiffResult
- type DiffSummary
- type Differ
- func (d *Differ) Compare(left, right interface{}, leftLabel, rightLabel string) (*DiffResult, error)
- func (d *Differ) CompareData(leftData, rightData []byte, leftLabel, rightLabel string) (*DiffResult, error)
- func (d *Differ) CompareFiles(leftPath, rightPath string) (*DiffResult, error)
- func (d *Differ) WithVFS(env vfs.Env) *Differ
- type Formatter
- type ImpactLevel
- type JSONPatchFormatter
- type SemanticFormatter
- type SideBySideFormatter
- type UnifiedFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
Path string
Operation ChangeOperation
OldValue interface{}
NewValue interface{}
Context []string
}
type ChangeOperation ¶
type ChangeOperation string
const ( ChangeOpAdd ChangeOperation = "add" ChangeOpRemove ChangeOperation = "remove" ChangeOpReplace ChangeOperation = "replace" )
type DiffFormat ¶
type DiffFormat string
const ( DiffFormatUnified DiffFormat = "unified" DiffFormatSideBySide DiffFormat = "side-by-side" DiffFormatJSONPatch DiffFormat = "json-patch" DiffFormatSemantic DiffFormat = "semantic" )
type DiffOptions ¶
type DiffResult ¶
type DiffSummary ¶
type DiffSummary struct {
Added int
Removed int
Modified int
Impact ImpactLevel
}
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
func NewDiffer ¶
func NewDiffer(opts DiffOptions) *Differ
func (*Differ) Compare ¶
func (d *Differ) Compare(left, right interface{}, leftLabel, rightLabel string) (*DiffResult, error)
func (*Differ) CompareData ¶
func (d *Differ) CompareData(leftData, rightData []byte, leftLabel, rightLabel string) (*DiffResult, error)
CompareData compares two already-read YAML or JSON documents. Callers that resolve their own inputs (e.g. stdin for `-f -`) use it instead of CompareFiles; the labels name each side in the output.
func (*Differ) CompareFiles ¶
func (d *Differ) CompareFiles(leftPath, rightPath string) (*DiffResult, error)
type Formatter ¶
type Formatter interface {
Format(result *DiffResult) (string, error)
}
type ImpactLevel ¶
type ImpactLevel string
const ( ImpactLow ImpactLevel = "low" ImpactMedium ImpactLevel = "medium" ImpactHigh ImpactLevel = "high" ImpactCritical ImpactLevel = "critical" )
type JSONPatchFormatter ¶
type JSONPatchFormatter struct{}
func (*JSONPatchFormatter) Format ¶
func (f *JSONPatchFormatter) Format(result *DiffResult) (string, error)
type SemanticFormatter ¶
type SemanticFormatter struct{}
func (*SemanticFormatter) Format ¶
func (f *SemanticFormatter) Format(result *DiffResult) (string, error)
type SideBySideFormatter ¶
type SideBySideFormatter struct {
// contains filtered or unexported fields
}
func (*SideBySideFormatter) Format ¶
func (f *SideBySideFormatter) Format(result *DiffResult) (string, error)
type UnifiedFormatter ¶
type UnifiedFormatter struct {
// contains filtered or unexported fields
}
func (*UnifiedFormatter) Format ¶
func (f *UnifiedFormatter) Format(result *DiffResult) (string, error)