Documentation ¶
Overview ¶
Package diff performs diffs on sorted channels of data
Index ¶
Constants ¶
const ( // NEW is an enum for a new/added value in a diff passed to ResultFunc NEW = iota // + // OLD is an enum for a removed value in a diff passed to ResultFunc OLD // - )
Variables ¶
This section is empty.
Functions ¶
func PrintStringDiff ¶
PrintStringDiff satisfies StringResultFunc can can be used as resultFunc in diff.Strings()
Types ¶
type Result ¶
Result stores statistics generated from diffing two streams
func Strings ¶
func Strings(ctx context.Context, aChan, bChan chan string, aErrChan chan error, bErrChan chan error, resultFunc StringResultFunc) (r Result, err error)
Strings takes 4 chan inputs, 2 for strings, and 2 for their corresponding error channels, and a StringResultFunc to be called for every new/old record found when done, counter results and errors (if any) are returned string chan input MUST be sorted, for performance reasons this is not checked!
type StringChanResult ¶
StringChanResult hold diff results for DiffStringResultChan
type StringResultFunc ¶
StringResultFunc defines the interface for a function to be called for each delta record
func StringResultChan ¶
func StringResultChan() (StringResultFunc, chan *StringChanResult)
StringResultChan allows diff.Strings() to be called in parallel with its resultFunc prosessing this function returns a StringResultFunc for use in diff.Strings(), and a channel for consuming diff results in another goroutine