Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CsvFileIterator ¶
type CsvFileIterator struct {
// contains filtered or unexported fields
}
CsvFileIterator make iterating rows from csv file easier, it reads tuple from csv file and turn it into a `map[string]interface{}` for you.
Example CSV format (exported by dbeaver):
"id","name","json","created_at" 123,"foobar","{""url"": ""https://example.com""}","2022-05-05 09:56:43.438000000"
func NewCsvFileIterator ¶
func NewCsvFileIterator(csvPath string) *CsvFileIterator
NewCsvFileIterator create a `*CsvFileIterator` based on path to csv file
func (*CsvFileIterator) Fetch ¶
func (ci *CsvFileIterator) Fetch() map[string]interface{}
Fetch returns current row
func (*CsvFileIterator) HasNext ¶
func (ci *CsvFileIterator) HasNext() bool
HasNext returns a boolean to indicate whether there was any row to be `Fetch`
type CsvFileWriter ¶
type CsvFileWriter struct {
// contains filtered or unexported fields
}
CsvFileWriter make writer for saving csv file easier, it write tuple to csv file
Example CSV format (exported by dbeaver):
"id","name","json","created_at" 123,"foobar","{""url"": ""https://example.com""}","2022-05-05 09:56:43.438000000"
func NewCsvFileWriter ¶
func NewCsvFileWriter(csvPath string, fields []string) *CsvFileWriter
NewCsvFileWriter create a `*CsvFileWriter` based on path to saving csv file
func (*CsvFileWriter) Flush ¶
func (ci *CsvFileWriter) Flush()
Flush the wrote data into file physically
func (*CsvFileWriter) Write ¶
func (ci *CsvFileWriter) Write(values []string)
Write the values into csv
Click to show internal directories.
Click to hide internal directories.