File: record_reader_factory.go

package info (click to toggle)
miller 6.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,928 kB
  • sloc: ruby: 162; sh: 119; makefile: 87
file content (36 lines) | stat: -rw-r--r-- 1,159 bytes parent folder | download | duplicates (2)
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
package input

import (
	"fmt"

	"github.com/johnkerl/miller/v6/pkg/cli"
)

func Create(readerOptions *cli.TReaderOptions, recordsPerBatch int64) (IRecordReader, error) {
	switch readerOptions.InputFileFormat {
	case "csv":
		return NewRecordReaderCSV(readerOptions, recordsPerBatch)
	case "csvlite":
		return NewRecordReaderCSVLite(readerOptions, recordsPerBatch)
	case "dkvp":
		return NewRecordReaderDKVP(readerOptions, recordsPerBatch)
	case "json":
		return NewRecordReaderJSON(readerOptions, recordsPerBatch)
	case "nidx":
		return NewRecordReaderNIDX(readerOptions, recordsPerBatch)
	case "md":
		return NewRecordReaderMarkdown(readerOptions, recordsPerBatch)
	case "markdown":
		return NewRecordReaderMarkdown(readerOptions, recordsPerBatch)
	case "pprint":
		return NewRecordReaderPPRINT(readerOptions, recordsPerBatch)
	case "tsv":
		return NewRecordReaderTSV(readerOptions, recordsPerBatch)
	case "xtab":
		return NewRecordReaderXTAB(readerOptions, recordsPerBatch)
	case "gen":
		return NewPseudoReaderGen(readerOptions, recordsPerBatch)
	default:
		return nil, fmt.Errorf("input file format \"%s\" not found", readerOptions.InputFileFormat)
	}
}