Documentation ¶
Index ¶
Constants ¶
const ( TypeMatch = iota TypeReplace )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharDiff ¶
type CharDiff struct {
// contains filtered or unexported fields
}
CharDiff is a per-character diff algorithm, meaning that it makes no distinctions about word or line boundaries when generating a diff.
func NewCharDiff ¶
func NewCharDiff(opts ...CharDiffOpt) *CharDiff
type CharDiffOpt ¶
CharDiffOpt is an option function for changing the behavior of the NewCharDiff constructor.
func CharDiffBaseCost ¶
func CharDiffBaseCost(cost float64) CharDiffOpt
CharDiffBaseCost is a CharDiff option to set the base cost per diff section. Increasing this will reduce the number of diff sections in the output at the cost of larger diff sections.
Default is 0.
func CharDiffPerCharCost ¶
func CharDiffPerCharCost(cost float64) CharDiffOpt
CharDiffPerCharCost is a CharDiff option to set the cost-per-character of any differences returned. Increasing this cost will reduce the size of diff sections at the cost of more diff sections.
Default is 1
type Diff ¶
type Diff interface { // Cost is the calculated cost of changing from one value to another. // Basically, if provided with multiple diffs, the Differ will always prefer // the lowest cost. // // Generally, a cost of 0 should represent exactly equal values, so negative // numbers shouldn't usually be used. However, if they are used, they will // work the same as positive values, being preferred over any value higher // than them. Cost() float64 // Sections returns all of the sections of the diff. This will be used to // generate output, depending on the diff formats being used. Sections() []DiffSection }
Diff represents a full diff of two values.
type DiffSection ¶
DiffSection represents a single chunk of a diff.