Documentation ¶
Overview ¶
Package slicediff is a utility to determine the additions and deletions that happened to a sorted slice after each update.
All the slices are assumed to be sorted!
Example ¶
// Create a new SliceDiff sd := New() // Add some initial elements sd.Append([]string{ "a", "b", "d", }) // Perform an update update := []string{ "a", "b", "c", } add, del := sd.SortedDiff(update) // Get the diff fmt.Println(add, del)
Output: [c] [d]
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SliceDiff ¶
type SliceDiff struct {
// contains filtered or unexported fields
}
SliceDiff stores the current state of the sorted slice
func (*SliceDiff) Append ¶
Append appends a slice at the end of the SliceDiff
sa is assumed to be sorted
func (*SliceDiff) SortedDiff ¶
SortedDiff compares the updated slice with l and returns the additions and deletions performed
updated is assumed to be sorted
Click to show internal directories.
Click to hide internal directories.