/
csv.go
39 lines (32 loc) · 937 Bytes
/
csv.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
package option
import "github.com/rockset/rockset-go-client/openapi"
type CSV func(*openapi.CsvParams)
func WithEncoding(encoding string) CSV {
return func(o *openapi.CsvParams) {
o.Encoding = &encoding
}
}
// WithSeparator sets the CSV separator. Defaults to ,
func WithSeparator(separator string) CSV {
return func(o *openapi.CsvParams) {
o.Separator = &separator
}
}
// WithQuoteChar sets the CSV quote character. Defaults to "
func WithQuoteChar(quote string) CSV {
return func(o *openapi.CsvParams) {
o.QuoteChar = "e
}
}
// WithEscapeChar sets the CSV escape character. Defaults to \
func WithEscapeChar(escape string) CSV {
return func(o *openapi.CsvParams) {
o.EscapeChar = &escape
}
}
// WithFirstLineAsColumnNames enables the use of the first row as the column names
func WithFirstLineAsColumnNames() CSV {
return func(o *openapi.CsvParams) {
o.FirstLineAsColumnNames = openapi.PtrBool(true)
}
}