Documentation
¶
Overview ¶
Package textdiff providers support for diff'ing text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DP ¶
func DP(a, b interface{}) lcs.EditScript
DP uses cloudeng.io/algo/myers to generate diffs.
func LineFNVHashDecoder ¶
LineFNVHashDecoder decodes a byte slice into newline delimited blocks each of which is represented by a 64 bit hash obtained from fnv.New64a.
func Myers ¶
func Myers(a, b interface{}) lcs.EditScript
Myers uses cloudeng.io/algo/myers to generate diffs.
Types ¶
type Diff ¶
type Diff struct {
// contains filtered or unexported fields
}
Diff represents the ability to diff two slices.
func DiffByLines ¶
DiffByLines calls DiffByLinesUsing with the Myers function.
func DiffByLinesUsing ¶
func DiffByLinesUsing(a, b []byte, engine func(a, b interface{}) lcs.EditScript) *Diff
DiffByLinesUsing diffs the supplied strings on a line-by-line basis using the supplied function to generate the diffs.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a single diff 'group', that is a set of insertions/deletions that are pertain to the same set of lines.
type LineDecoder ¶
type LineDecoder struct {
// contains filtered or unexported fields
}
LineDecoder represents a decoder that can be used to split a byte stream into lines for use with the cloudeng.io/algo/lcs package.
func NewLineDecoder ¶
func NewLineDecoder(fn func(data []byte) (string, int64, int)) *LineDecoder
NewLineDecoder returns a new instance of LineDecoder.
func (*LineDecoder) Decode ¶
func (ld *LineDecoder) Decode(data []byte) (int64, int)
Decode can be used as the decode function when creating a new decoder using cloudeng.io/algo.codec.NewDecoder.
func (*LineDecoder) Line ¶
func (ld *LineDecoder) Line(i int) (string, uint64)
Line returns the i'th line.
func (*LineDecoder) NumLines ¶
func (ld *LineDecoder) NumLines() int
NumLines returns the number of lines decoded.