forked from aswinkarthik/csvdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
41 lines (37 loc) · 886 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package digest
import "io"
// 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 Config struct {
Key Positions
Value Positions
Include Positions
Reader io.Reader
Separator rune
LazyQuotes bool
}
// NewConfig creates an instance of Config struct.
func NewConfig(
r io.Reader,
primaryKey Positions,
valueColumns Positions,
includeColumns Positions,
separator rune,
lazyQuotes bool,
) *Config {
if len(includeColumns) == 0 {
includeColumns = valueColumns
}
return &Config{
Reader: r,
Key: primaryKey,
Value: valueColumns,
Include: includeColumns,
Separator: separator,
LazyQuotes: lazyQuotes,
}
}