Extractors implemented. Exporters name simplified. README Updated for extracting data. Removed go 1.11 support

This commit is contained in:
Musab Gültekin
2019-06-28 13:00:30 +03:00
parent 679fd8ab7a
commit b000581c3d
13 changed files with 138 additions and 27 deletions

View File

@ -10,15 +10,15 @@ import (
"sort"
)
// CSVExporter exports response data as CSV streaming file
type CSVExporter struct {
// CSV exports response data as CSV streaming file
type CSV struct {
FileName string
Comma rune
UseCRLF bool
}
// Export exports response data as CSV streaming file
func (e *CSVExporter) Export(exports chan interface{}) {
func (e *CSV) Export(exports chan interface{}) {
// Create or append file
file, err := os.OpenFile(internal.PreferFirst(e.FileName, "out.csv"), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)

View File

@ -6,7 +6,7 @@ func TestCSVExporter_Export(t *testing.T) {
ch := make(chan interface{})
defer close(ch)
exporter := &CSVExporter{
exporter := &CSV{
FileName: "out.csv",
Comma: ';',
}

View File

@ -7,8 +7,8 @@ import (
"os"
)
// JSONExporter exports response data as JSON streaming file
type JSONExporter struct {
// JSON exports response data as JSON streaming file
type JSON struct {
FileName string
EscapeHTML bool
Prefix string
@ -16,7 +16,7 @@ type JSONExporter struct {
}
// Export exports response data as JSON streaming file
func (e *JSONExporter) Export(exports chan interface{}) {
func (e *JSON) Export(exports chan interface{}) {
// Create or append file
file, err := os.OpenFile(internal.PreferFirst(e.FileName, "out.json"), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)

View File

@ -6,7 +6,7 @@ func TestJSONExporter_Export(t *testing.T) {
ch := make(chan interface{})
defer close(ch)
exporter := &JSONExporter{
exporter := &JSON{
FileName: "out.json",
Indent: " ",
}