Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Addition ¶ added in v1.5.0
type Addition []string
Addition is a row appearing in delta but missing in base
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 Deletion ¶ added in v1.5.0
type Deletion []string
Deletion is a row appearing in base but missing in delta
type Differences ¶ added in v1.5.0
type Differences struct { Additions []Addition Modifications []Modification Deletions []Deletion }
Differences represents the differences between 2 csv content
func Diff ¶ added in v1.0.0
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 ¶ added in v1.5.0
type Engine struct {
// contains filtered or unexported fields
}
Engine to create a FileDigest
func (Engine) GenerateFileDigest ¶ added in v1.5.0
func (e Engine) GenerateFileDigest() (*FileDigest, error)
GenerateFileDigest generates FileDigest with thread safety
func (Engine) StreamDigests ¶ added in v1.5.0
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 ¶ added in v1.5.0
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 NewFileDigest ¶ added in v1.5.0
func NewFileDigest() *FileDigest
NewFileDigest to instantiate a new FileDigest
func (*FileDigest) Append ¶ added in v1.5.0
func (f *FileDigest) Append(d Digest)
Append a Digest to a FileDigest This operation is not thread safe
func (*FileDigest) SafeAppend ¶ added in v1.5.0
func (f *FileDigest) SafeAppend(d Digest)
SafeAppend a Digest to a FileDigest This operation is thread safe
type Modification ¶ added in v1.5.0
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 ¶ added in v1.5.0
Append additional positions to existing positions. Imp: Removes Duplicate. Does not mutate the original array
func (Positions) Contains ¶ added in v1.5.0
Contains returns true if position is already present in Positions