go: cuelang.org/go/internal/diff Index | Files

package diff

import "cuelang.org/go/internal/diff"

Index

Package Files

diff.go print.go

Variables

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

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

func Diff Uses

func Diff(x, y cue.Value) (Kind, *EditScript)

Diff is a shorthand for Schema.Diff.

func Print Uses

func Print(w io.Writer, es *EditScript) error

Print the differences between two structs represented by an edit script.

type Edit Uses

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

Edit represents a single operation within an edit-script.

func (Edit) Kind Uses

func (e Edit) Kind() Kind

func (Edit) XPos Uses

func (e Edit) XPos() int

func (Edit) YPos Uses

func (e Edit) YPos() int

type EditScript Uses

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

EditScript represents the series of differences between two CUE values. x and y must be either both list or struct.

func (*EditScript) LabelX Uses

func (es *EditScript) LabelX(i int) string

Label returns a string representation of the label.

func (*EditScript) LabelY Uses

func (es *EditScript) LabelY(i int) string

func (*EditScript) Len Uses

func (es *EditScript) Len() int

Len returns the number of edits.

func (*EditScript) ValueX Uses

func (es *EditScript) ValueX(i int) (v cue.Value)

ValueX returns the value of X involved at step i.

func (*EditScript) ValueY Uses

func (es *EditScript) ValueY(i int) (v cue.Value)

ValueY returns the value of Y involved at step i.

type Kind Uses

type Kind uint8

Kind identifies the kind of operation of an edit script.

const (
    // Identity indicates that a value pair is identical in both list X and Y.
    Identity Kind = iota
    // UniqueX indicates that a value only exists in X and not Y.
    UniqueX
    // UniqueY indicates that a value only exists in Y and not X.
    UniqueY
    // Modified indicates that a value pair is a modification of each other.
    Modified
)

type Profile Uses

type Profile struct {
    Concrete bool
}

Profile configures a diff operation.

func (*Profile) Diff Uses

func (p *Profile) Diff(x, y cue.Value) (Kind, *EditScript)

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

Package diff imports 4 packages (graph) and is imported by 2 packages. Updated 2020-09-28. Refresh now. Tools for package owners.