diff

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package diff provides helpers to compare JSON and YAML data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NoColor      bool   `json:"no_color,omitempty" yaml:"no_color,omitempty"`
	Format       string `json:"format,omitempty" yaml:"format,omitempty"`
	ContextLines int    `json:"context_lines,omitempty" yaml:"context_lines,omitempty"`
	// contains filtered or unexported fields
}

Config holds necessary information of diff.

func NewDiff

func NewDiff(format string, noColor bool, log *logrus.Logger) *Config

NewDiff returns a new instance of Config.

func (*Config) Diff

func (cfg *Config) Diff(oldData, newData string) (bool, string, error)

Diff identifies the discrepancies between two provided objects, which can be in formats such as YAML or JSON.

func (*Config) String

func (cfg *Config) String(input any) (string, error)

String returns the string representation of the DataStructure in the specified format.

Jump to

Keyboard shortcuts

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