diff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CREATE represents when an element has been added
	CREATE = "create"
	// UPDATE represents when an element has been updated
	UPDATE = "update"
	// DELETE represents when an element has been removed
	DELETE = "delete"
)

Variables

View Source
var (
	// Schema is the standard profile used for comparing schema.
	Schema = &Profile{}

	// Final is the standard profile for comparing data.
	Final = &Profile{
		UseDefaults:       true,
		IgnoreDefinitions: true,
	}
)

Functions

This section is empty.

Types

type Change

type Change struct {
	Type string
	Path cue.Path
	From *cue.Value
	To   *cue.Value
}

Change stores information about a changed item

type Changelog

type Changelog []Change

Changelog stores a list of changed items

func Diff

func Diff(x, y cue.Value) (Changelog, error)

Diff is a shorthand for Final.Diff.

func (*Changelog) Add

func (cl *Changelog) Add(t string, path cue.Path, from *cue.Value, to *cue.Value)

type Profile

type Profile struct {
	UseDefaults        bool
	IgnoreDefinitions  bool
	IgnoreHiddenFields bool

	// Ignores optional fields.
	// An added or removed optional field will not be recorded in the changelog.
	// However if an optional field is defined as a regular field it will be
	// recorded like if it was a new regular field.
	IgnoreOptionalFields bool
}

func (*Profile) Diff

func (p *Profile) Diff(x, y cue.Value) (Changelog, error)

Diff returns an edit script representing the difference between x and y.

Jump to

Keyboard shortcuts

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