mirror of
https://github.com/nxshock/mssqlbulkloader.git
synced 2024-11-27 00:11:02 +05:00
29 lines
517 B
Go
29 lines
517 B
Go
|
package main
|
||
|
|
||
|
type Reader interface {
|
||
|
// GetHeaders returns list of column names
|
||
|
GetHeader() []string
|
||
|
|
||
|
// GetRows returns next one file row or io.EOF
|
||
|
GetRow(asString bool) ([]any, error)
|
||
|
|
||
|
// Options returns options
|
||
|
Options() *Options
|
||
|
|
||
|
Close() error
|
||
|
}
|
||
|
|
||
|
func getHeader(r Reader) ([]string, error) {
|
||
|
headerAny, err := r.GetRow(true)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
header := make([]string, 0, len(headerAny))
|
||
|
for _, v := range headerAny {
|
||
|
header = append(header, v.(string))
|
||
|
}
|
||
|
|
||
|
return header, nil
|
||
|
}
|