Skip to content

Commit 2f2b4b6

Browse files
authored
New CsvOption - UseCRLF (#30)
True to use \r\n as the line terminator
1 parent 227d4c7 commit 2f2b4b6

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

csvtag.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package csvtag
33
// CsvOptions - options when loading or dumping csv.
44
type CsvOptions struct {
55
Separator rune
6+
UseCRLF bool // True to use \r\n as the line terminator
67
Header []string
78
TagKey string
89
}

dump.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func DumpToWriter(slice interface{}, writer io.Writer, options ...CsvOptions) er
5151
csvWriter.Comma = option.Separator
5252
}
5353

54+
csvWriter.UseCRLF = option.UseCRLF
55+
5456
err := csvWriter.Write(option.Header)
5557
if err != nil {
5658
return err

0 commit comments

Comments
 (0)