Help us shape the future of Go! Take the 2026 Go Developer Survey

model

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDiff

type FileDiff struct {
	File      value.ChangedFile
	Stat      value.FileStat
	Lines     []Line
	OldTotal  int
	NewTotal  int
	Changes   []int // indices where add/del runs begin, for jump keys
	Binary    bool
	Truncated bool
	Err       error
	HasStat   bool `json:"-"`
	IsLoaded  bool `json:"-"`
	// contains filtered or unexported fields
}

func BuildFile

func BuildFile(oldContent, newContent []byte, file value.ChangedFile, stat value.FileStat) FileDiff

func (FileDiff) Clone

func (fd FileDiff) Clone() FileDiff

func (*FileDiff) Loaded

func (fd *FileDiff) Loaded() bool

func (*FileDiff) SideBySideRows

func (fd *FileDiff) SideBySideRows() []Row

func (*FileDiff) StatKnown

func (fd *FileDiff) StatKnown() bool

StatKnown reports whether Stat holds a real count rather than an unknown one.

type Line

type Line struct {
	Kind   LineKind
	OldNum int // 0 when the line only exists in the new file
	NewNum int // 0 when the line only exists in the old file
	Text   string
	Spans  []Span
	Pair   int // index of the counterpart Del/Add line; -1 when unpaired
}

type LineKind

type LineKind uint8
const (
	Same LineKind = iota
	Add
	Del
	Gap // a marker standing in for lines the hunk model left out
)

type Row

type Row struct {
	Left, Right int
}

Row addresses one side-by-side display row; -1 means a blank cell.

type Set

type Set struct {
	Repo         value.Repo
	Scope        value.Scope
	BaseDesc     string
	BaseRef      string
	BaseOverride string
	Files        []FileDiff
}

func (Set) Clone

func (set Set) Clone() Set

type Span

type Span struct {
	Start, End int
}

Span marks a changed byte range within a line's text.

Jump to

Keyboard shortcuts

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