pluginhelper

package
v0.12.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 2

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) Close

func (ci *CsvFileIterator) Close()

Close releases resource

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) Close

func (ci *CsvFileWriter) Close()

Close releases resource

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL