parsers

package
v0.0.0-...-4214274 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package parsers is generated by Handlergenerator tooling Make sure to insert real Description here

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultDelimiter is the delimiter used if nothing is set
	DefaultDelimiter = ","
	// DefaultHeaderLength is the headerlength to use if nothing else is set
	DefaultHeaderLength = 1
	// DefaultSkipRows is the default rows to skip if nothing is set
	DefaultSkipRows = 0

	//ErrNotCsv is triggered when the input file is not proper csv
	ErrNotCsv error = errors.New("this is not a proper csv file")
	//ErrHeaderMismatch is triggered when header is longer than CSV records
	ErrHeaderMismatch error = errors.New("the header is not the same size as the records")
)

Functions

func NewParseCSVHandler

func NewParseCSVHandler() handlers.Handler

NewParseCSVHandler generates a new ParseCSV Handler

Types

type ParseCSV

type ParseCSV struct {
	// Cfg is values needed to properly run the Handle func
	Cfg  *property.Configuration `json:"configs" yaml:"configs"`
	Name string                  `json:"handler_name" yaml:"handler_name"`

	// MetricPayloadOut is how many payloads the processor has outputted
	MetricPayloadOut string
	// MetricPayloadIn is how many payloads the processor has inputted
	MetricPayloadIn string
	// contains filtered or unexported fields
}

ParseCSV is used to parse CSV files, expects whole payloads

func (*ParseCSV) GetConfiguration

func (a *ParseCSV) GetConfiguration() *property.Configuration

GetConfiguration will return the CFG for the Handler

func (*ParseCSV) GetErrorChannel

func (a *ParseCSV) GetErrorChannel() chan error

GetErrorChannel will return a channel that the Handler can output eventual errors onto

func (*ParseCSV) GetHandlerName

func (a *ParseCSV) GetHandlerName() string

GetHandlerName is used to retrun a unqiue string name

func (ParseCSV) Handle

func (a ParseCSV) Handle(ctx context.Context, input payload.Payload, topics ...string) error

Handle will go through a CSV payload and output all the CSV rows

func (*ParseCSV) SetMetricProvider

func (a *ParseCSV) SetMetricProvider(p metric.Provider, prefix string) error

SetMetricProvider is used to change what metrics provider is used by the handler

func (*ParseCSV) Subscriptionless

func (a *ParseCSV) Subscriptionless() bool

Subscriptionless will return true/false if the Handler is genereating payloads itself

func (*ParseCSV) ValidateConfiguration

func (a *ParseCSV) ValidateConfiguration() (bool, []string)

ValidateConfiguration is used to see that all needed configurations are assigned before starting

Jump to

Keyboard shortcuts

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