Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Key Positions Value Positions Include Positions Reader io.Reader Separator rune LazyQuotes bool }
Config represents configurations that can be passed to create a Digest.
Key: The primary key positions Value: The Value positions that needs to be compared for diff Include: Include these positions in output. It is Value positions by default.
type Differences ¶
type Differences struct { Additions []Addition Modifications []Modification Deletions []Deletion }
Differences represents the differences between 2 csv content
func Diff ¶
func Diff(baseConfig, deltaConfig Config) (Differences, error)
Diff finds the Differences between baseConfig and deltaConfig
type Digest ¶
Digest represents the binding of the key of each csv line and the digest that gets created for the entire line
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine to create a FileDigest
func (Engine) GenerateFileDigest ¶
func (e Engine) GenerateFileDigest() (*FileDigest, error)
GenerateFileDigest generates FileDigest with thread safety
func (Engine) StreamDigests ¶
StreamDigests starts creating digests in the background Returns 2 buffered channels, a digestChannel and an errorChannel
digestChannel has all digests errorChannel has any errors created during processing
If there are any errors while processing csv, all existing go routines to creates digests are waited to be closed and the digestChannel is closed at the end. Only after that an error is created on the errorChannel.
type FileDigest ¶
type FileDigest struct { Digests map[uint64]uint64 SourceMap map[uint64][]string // contains filtered or unexported fields }
FileDigest represents the digests created from one file
func (*FileDigest) Append ¶
func (f *FileDigest) Append(d Digest)
Append a Digest to a FileDigest This operation is not thread safe
func (*FileDigest) SafeAppend ¶
func (f *FileDigest) SafeAppend(d Digest)
SafeAppend a Digest to a FileDigest This operation is thread safe
type Modification ¶
Modification is a row present in both delta and base with the values column changed in delta
type Positions ¶
type Positions []int
Positions represents positions of columns in a CSV array.
func (Positions) Append ¶
Append additional positions to existing positions. Imp: Removes Duplicate. Does not mutate the original array