fileparser_action

package
v0.0.0-...-f514c2e Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

File parser action

Input

The input map can contain the following values:

Key Description Allowed values
Filetype The type of file to parse "csv"
File Raw file as byte array ([]byte) Any []byte
Header Indicate whether a CSV file contains a header. If it does the result will contain the keys. true or false (optional)

Output

  • Messages: The output of the file parser action is a map with messages. Messages contains an array of map[string]interface{}.
CSV

In case the CSV does not contain headers the result will be put in a map based on the order of the columns. The keys in the map will be the column number prefixed with 'col-', e.g. the first column of a csv file without headers will be part of a message output map under the key 'col-1'.

Documentation

Index

Constants

View Source
const (
	FileType  = "filetype"
	File      = "file"
	Header    = "header"
	Delimiter = "delimiter"
)

Variables

This section is empty.

Functions

func Invoke

func Invoke(stub domain.Stub, input map[string]interface{}) (output map[string]interface{}, err error)

func ParseCsv

func ParseCsv(stub domain.Stub, rawFile []byte, header bool, delimiter rune) (map[string]interface{}, error)

func ParseJson

func ParseJson(logger logger.Logger, rawJson []byte) (map[string]interface{}, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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