diff

package
v0.19.768 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Key      string
	Diff     *DiffKey
	Children []*Diff
}

func NewDiff

func NewDiff(opts ...DiffOption) *Diff

func (*Diff) String

func (d *Diff) String(indent string) string

func (*Diff) Summary

func (d *Diff) Summary() DiffSummary

type DiffKey

type DiffKey struct {
	Op   Op
	Diff string
}

type DiffOption

type DiffOption func(*Diff)

func WithChildren

func WithChildren(children ...*Diff) DiffOption

func WithKey

func WithKey(key string) DiffOption

func WithStringDiff

func WithStringDiff(old, new string) DiffOption

type DiffSummary

type DiffSummary struct {
	HasChanged bool
	Added      int
	Removed    int
	Changed    int
	Unchanged  int
}

type Diffable

type Diffable interface {
	Diff() (string, Op)
}

type Op

type Op string
const (
	OpAdd     Op = "add"
	OpRemove  Op = "remove"
	OpChange  Op = "change"
	OpNoop    Op = "noop"
	OpUnknown Op = ""
)

type StringDiffer

type StringDiffer struct {
	// contains filtered or unexported fields
}

func (*StringDiffer) Diff

func (d *StringDiffer) Diff() (string, Op)

Jump to

Keyboard shortcuts

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