Skip to content

Commit

Permalink
feat: Change option name (#44)
Browse files Browse the repository at this point in the history


<!--
Explain what problem this PR addresses
-->

---
  • Loading branch information
bbernays authored Jan 27, 2023
1 parent cd02912 commit 0dd709b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewClient(spec *FileSpec) (*Client, error) {
opts := []csvFile.Options{
csvFile.WithDelimiter([]rune(spec.csvSpec.Delimiter)[0]),
}
if spec.csvSpec.IncludeHeaders {
if !spec.csvSpec.SkipHeader {
opts = append(opts, csvFile.WithHeader())
}

Expand Down
4 changes: 2 additions & 2 deletions csv/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package csv
import "fmt"

type Spec struct {
IncludeHeaders bool `json:"include_headers,omitempty"`
Delimiter string `json:"delimiter,omitempty"`
SkipHeader bool `json:"skip_header,omitempty"`
Delimiter string `json:"delimiter,omitempty"`
}

func (s *Spec) SetDefaults() {
Expand Down
24 changes: 12 additions & 12 deletions spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ func TestSpecMethods(t *testing.T) {
},
preDefaultsCSV: &csv.Spec{},
postDefaultsCSV: &csv.Spec{
IncludeHeaders: false,
Delimiter: ",",
SkipHeader: false,
Delimiter: ",",
},
},
{
FileSpec: &FileSpec{
Format: FormatTypeCSV,
FormatSpec: map[string]any{
"delimiter": ",",
"include_headers": true,
"delimiter": ",",
"skip_header": true,
},
},
preDefaultsCSV: &csv.Spec{
IncludeHeaders: true,
Delimiter: ",",
SkipHeader: true,
Delimiter: ",",
},
postDefaultsCSV: &csv.Spec{
IncludeHeaders: true,
Delimiter: ",",
SkipHeader: true,
Delimiter: ",",
},
},
{
Expand All @@ -51,12 +51,12 @@ func TestSpecMethods(t *testing.T) {
FormatSpec: map[string]any{},
},
preDefaultsCSV: &csv.Spec{
IncludeHeaders: false,
Delimiter: "",
SkipHeader: false,
Delimiter: "",
},
postDefaultsCSV: &csv.Spec{
IncludeHeaders: false,
Delimiter: ",",
SkipHeader: false,
Delimiter: ",",
},
},
{
Expand Down

0 comments on commit 0dd709b

Please sign in to comment.