MCPcopy Create free account
hub / github.com/dolthub/doltgresql / NewTabularDataLoader

Function NewTabularDataLoader

core/dataloader/tabdataloader.go:48–69  ·  view source on GitHub ↗

NewTabularDataLoader creates a new TabularDataLoader to insert into the specified |table| using the specified |delimiterChar| and |nullChar|. If |header| is true, the first line of the data will be treated as a header and ignored.

(colNames []string, tableSch sql.Schema, delimiterChar, nullChar string, header bool)

Source from the content-addressed store, hash-verified

46// |delimiterChar| and |nullChar|. If |header| is true, the first line of the data will be treated as a header and
47// ignored.
48func NewTabularDataLoader(colNames []string, tableSch sql.Schema, delimiterChar, nullChar string, header bool) (*TabularDataLoader, error) {
49 colTypes, reducedSch, err := getColumnTypes(colNames, tableSch)
50 if err != nil {
51 return nil, err
52 }
53
54 if delimiterChar == "" {
55 delimiterChar = defaultTextDelimiter
56 }
57
58 if nullChar == "" {
59 nullChar = defaultNullChar
60 }
61
62 return &TabularDataLoader{
63 colTypes: colTypes,
64 sch: reducedSch,
65 delimiterChar: delimiterChar,
66 nullChar: nullChar,
67 removeHeader: header,
68 }, nil
69}
70
71// nextRow returns the next SQL row from the reader provided, using any previously saved partial line. Returns true if
72// there was another row.

Callers 2

handleCopyDataHelperMethod · 0.92
TestTabDataLoaderFunction · 0.92

Calls 1

getColumnTypesFunction · 0.85

Tested by 1

TestTabDataLoaderFunction · 0.74