Skip to content

Commit

Permalink
New CsvOption - UseCRLF (#30)
Browse files Browse the repository at this point in the history
True to use \r\n as the line terminator
  • Loading branch information
chenall authored May 23, 2024
1 parent 227d4c7 commit 2f2b4b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions csvtag.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package csvtag
// CsvOptions - options when loading or dumping csv.
type CsvOptions struct {
Separator rune
UseCRLF bool // True to use \r\n as the line terminator
Header []string
TagKey string
}
Expand Down
2 changes: 2 additions & 0 deletions dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func DumpToWriter(slice interface{}, writer io.Writer, options ...CsvOptions) er
csvWriter.Comma = option.Separator
}

csvWriter.UseCRLF = option.UseCRLF

err := csvWriter.Write(option.Header)
if err != nil {
return err
Expand Down

0 comments on commit 2f2b4b6

Please # to comment.