diff

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyArgs = errors.New("diff accepts at most 2 snapshot arguments")

Functions

func FormatCommandError

func FormatCommandError(err error) string

func Run

func Run(opts Options) (string, error)

Types

type DiffDataCorpora

type DiffDataCorpora struct {
	Paths []string
	Left  SnapshotDataCorpus
	Right SnapshotDataCorpus
}

type DiffEntry

type DiffEntry struct {
	Kind         DiffEntryKind
	Type         string
	ObjectID     string
	OldValue     map[string]any
	NewValue     map[string]any
	FieldChanges []DiffFieldChange
	OldSources   []LogicalObjectSource
	NewSources   []LogicalObjectSource
}

type DiffEntryKind

type DiffEntryKind string
const (
	DiffEntryKindAdded     DiffEntryKind = "added"
	DiffEntryKindRemoved   DiffEntryKind = "removed"
	DiffEntryKindModified  DiffEntryKind = "modified"
	DiffEntryKindRelocated DiffEntryKind = "relocated"
)

type DiffFieldChange

type DiffFieldChange struct {
	Path     string
	OldValue any
	NewValue any
}

type DiffResult

type DiffResult struct {
	Entries []DiffEntry
}

type DiffSnapshots

type DiffSnapshots struct {
	Left  SnapshotRef
	Right SnapshotRef
}

type LogicalDatabase

type LogicalDatabase struct {
	Snapshot SnapshotRef
	Objects  []LogicalObject
}

LogicalDatabase is the normalized repository-wide data model used by diff.

Invariants:

  • object identity is derived from Mergeway semantics, never file path
  • source paths are preserved as metadata for rendering and future merge work
  • object ordering is deterministic so downstream diff/render steps stay stable

type LogicalDatabaseBuildError

type LogicalDatabaseBuildError struct {
	Kind     LogicalDatabaseErrorKind
	Snapshot SnapshotRef
	TypeName string
	ObjectID string
	Path     string
	Selector string
	Err      error
}

func (*LogicalDatabaseBuildError) Error

func (e *LogicalDatabaseBuildError) Error() string

func (*LogicalDatabaseBuildError) Unwrap

func (e *LogicalDatabaseBuildError) Unwrap() error

type LogicalDatabaseErrorKind

type LogicalDatabaseErrorKind string
const (
	LogicalDatabaseErrorParse             LogicalDatabaseErrorKind = "parse"
	LogicalDatabaseErrorInvalidObject     LogicalDatabaseErrorKind = "invalid_object"
	LogicalDatabaseErrorIdentityCollision LogicalDatabaseErrorKind = "identity_collision"
)

type LogicalObject

type LogicalObject struct {
	Type      string
	ID        string
	Fields    map[string]any
	Canonical string
	Sources   []LogicalObjectSource
}

type LogicalObjectSource

type LogicalObjectSource struct {
	Path     string
	Selector string
	ReadOnly bool
}

type Options

type Options struct {
	Root   string
	Config string
	Args   []string
	JSON   bool
}

type SnapshotDataCorpus

type SnapshotDataCorpus struct {
	Snapshot SnapshotRef
	Schema   *diffSnapshotSchema
	Files    []SnapshotDataFile
}

type SnapshotDataFile

type SnapshotDataFile struct {
	Path    string
	Exists  bool
	Content []byte
}

type SnapshotKind

type SnapshotKind string
const (
	SnapshotKindHead        SnapshotKind = "head"
	SnapshotKindRevision    SnapshotKind = "revision"
	SnapshotKindWorkingTree SnapshotKind = "working_tree"
)

type SnapshotRef

type SnapshotRef struct {
	Kind            SnapshotKind
	Revision        string
	WorkingTreeView WorkingTreeView
}

func (SnapshotRef) String

func (s SnapshotRef) String() string

type WorkingTreeView

type WorkingTreeView string
const (
	WorkingTreeViewFull        WorkingTreeView = "full"
	WorkingTreeViewUnstaged    WorkingTreeView = "unstaged"
	WorkingTreeViewUnspecified WorkingTreeView = ""
)

Jump to

Keyboard shortcuts

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