Extractors implemented. Exporters name simplified. README Updated for extracting data. Removed go 1.11 support
This commit is contained in:
@ -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)
|
||||
|
@ -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: ';',
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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: " ",
|
||||
}
|
||||
|
Reference in New Issue
Block a user