XXX This is a placeholder for an option that will allow one to convert all csv fields to strings and defer any type coercion presumably to SuperSQL shapers. Currently, this causes an import cycle because the csvio Writer depends on fuse. We should refactor this so whatever logic wants to tack on a
(sctx *super.Context, r io.Reader, opts ReaderOpts)
| 35 | //} |
| 36 | |
| 37 | func NewReader(sctx *super.Context, r io.Reader, opts ReaderOpts) *Reader { |
| 38 | preprocess := newPreprocess(r, opts.Delim) |
| 39 | reader := csv.NewReader(preprocess) |
| 40 | if opts.Delim != 0 { |
| 41 | reader.Comma = opts.Delim |
| 42 | } |
| 43 | if !unicode.IsSpace(reader.Comma) { |
| 44 | // TrimLeadingSpace will trim leading and trailing space characters |
| 45 | // even if the delimiter is a space character so only enable this if |
| 46 | // reader.Comma is not a space character. |
| 47 | reader.TrimLeadingSpace = true |
| 48 | } |
| 49 | reader.ReuseRecord = true |
| 50 | return &Reader{ |
| 51 | reader: reader, |
| 52 | marshaler: sup.NewBSUPMarshalerWithContext(sctx), |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (r *Reader) Read() (*super.Value, error) { |
| 57 | for { |