Documentation
¶
Index ¶
- Constants
- func AsSequenceNode(list ...string) *yamlv3.Node
- func ChangeRoot(inputFile *ytbx.InputFile, path string, useGoPatchPaths bool, ...) error
- func CreateTableStyleString(separator string, indent int, columns ...string) string
- type BriefReport
- type CompareOption
- func AdditionalIdentifiers(fieldNames ...string) CompareOption
- func DetectRenames(value bool) CompareOption
- func IgnoreOrderChanges(value bool) CompareOption
- func IgnoreWhitespaceChanges(value bool) CompareOption
- func KubernetesEntityDetection(value bool) CompareOption
- func NonStandardIdentifierGuessCountThreshold(nonStandardIdentifierGuessCountThreshold int) CompareOption
- type Detail
- type Diff
- type DiffSyntaxReport
- type HumanReport
- type Report
- type ReportWriter
Constants ¶
const ( ADDITION = '+' REMOVAL = '-' MODIFICATION = '±' ORDERCHANGE = '⇆' )
Constants to distinguish between the different kinds of differences
Variables ¶
This section is empty.
Functions ¶
func AsSequenceNode ¶
AsSequenceNode translates a string list into a SequenceNode
func ChangeRoot ¶
func ChangeRoot(inputFile *ytbx.InputFile, path string, useGoPatchPaths bool, translateListToDocuments bool) error
ChangeRoot changes the root of an input file to a position inside its document based on the given path. Input files with more than one document are not supported, since they could have multiple elements with that path.
func CreateTableStyleString ¶
CreateTableStyleString takes the multi-line input strings as columns and arranges an output string to create a table-style output format with proper padding so that the text blocks can be arranged next to each other.
Types ¶
type BriefReport ¶
type BriefReport struct {
Report
}
BriefReport is a reporter that only prints a summary
func (*BriefReport) WriteReport ¶
func (report *BriefReport) WriteReport(out io.Writer) error
WriteReport writes a brief summary to the provided writer
type CompareOption ¶ added in v1.0.4
type CompareOption func(*compareSettings)
CompareOption sets a specific compare setting for the object comparison
func AdditionalIdentifiers ¶ added in v1.5.6
func AdditionalIdentifiers(fieldNames ...string) CompareOption
AdditionalIdentifiers specifies additional identifiers that will be used as the key for matching maps from source to target.
func DetectRenames ¶ added in v1.10.0
func DetectRenames(value bool) CompareOption
DetectRenames enabled detection of renames so that it correlates two entries based on their identifier field
func IgnoreOrderChanges ¶ added in v1.0.4
func IgnoreOrderChanges(value bool) CompareOption
IgnoreOrderChanges disables the detection for changes of the order in lists
func IgnoreWhitespaceChanges ¶ added in v1.9.0
func IgnoreWhitespaceChanges(value bool) CompareOption
IgnoreWhitespaceChanges disables the detection for whitespace only changes
func KubernetesEntityDetection ¶ added in v1.2.0
func KubernetesEntityDetection(value bool) CompareOption
KubernetesEntityDetection enabled detecting entity identifiers from Kubernetes "kind:" and "metadata:" fields.
func NonStandardIdentifierGuessCountThreshold ¶
func NonStandardIdentifierGuessCountThreshold(nonStandardIdentifierGuessCountThreshold int) CompareOption
NonStandardIdentifierGuessCountThreshold specifies how many list entries are needed for the guess-the-identifier function to actually consider the key name. Or in short, if the lists only contain two entries each, there are more possibilities to find unique enough key, which might not qualify as such.
type Detail ¶
Detail encapsulate the actual details of a change, mainly the kind of difference and the values
type DiffSyntaxReport ¶ added in v1.8.0
type DiffSyntaxReport struct {
PathPrefix string
RootDescriptionPrefix string
ChangeTypePrefix string
HumanReport
}
DiffSyntaxReport is a reporter with human readable output in mind
func (*DiffSyntaxReport) WriteReport ¶ added in v1.8.0
func (report *DiffSyntaxReport) WriteReport(out io.Writer) error
WriteReport writes a human readable report to the provided writer
type HumanReport ¶
type HumanReport struct {
Report
Indent int
UseIndentLines bool
MinorChangeThreshold float64
MultilineContextLines int
NoTableStyle bool
DoNotInspectCerts bool
OmitHeader bool
UseGoPatchPaths bool
PrefixMultiline bool
}
HumanReport is a reporter with human readable output in mind
func (*HumanReport) LoadX509Certs ¶
func (report *HumanReport) LoadX509Certs(from, to string) (string, string, error)
LoadX509Certs tries to load the provided strings as a cert each and returns a textual representation of the certs, or an error if the strings are not X509 certs
func (*HumanReport) WriteReport ¶
func (report *HumanReport) WriteReport(out io.Writer) error
WriteReport writes a human readable report to the provided writer
type Report ¶
Report encapsulates the actual end-result of the comparison: The input data and the list of differences
func CompareInputFiles ¶
func CompareInputFiles(from ytbx.InputFile, to ytbx.InputFile, compareOptions ...CompareOption) (Report, error)
CompareInputFiles is one of the convenience main entry points for comparing objects. In this case the representation of an input file, which might contain multiple documents. It returns a report with the list of differences.
func (Report) Exclude ¶ added in v1.5.3
Exclude accepts YAML paths as input and returns a new report with differences without those paths
func (Report) ExcludeRegexp ¶ added in v1.5.3
ExcludeRegexp accepts regular expressions as input and returns a new report with differences for not matching those patterns
func (Report) Filter ¶ added in v1.4.0
Filter accepts YAML paths as input and returns a new report with differences for those paths only
func (Report) FilterRegexp ¶ added in v1.5.3
FilterRegexp accepts regular expressions as input and returns a new report with differences for matching those patterns
func (Report) IgnoreValueChanges ¶ added in v1.10.0
type ReportWriter ¶
ReportWriter defines the interface required for types that can write reports