process

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

TODO: the gval.Language stuff should go into a separate module.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAverageCycleNRowsPerTime = errors.New("average-cycle: bad number of rows per time")
	ErrAverageCycleTimeMismatch = errors.New("average-cycle: cycle time mismatch")
)
View Source
var (
	ErrBadFilterAggregation = fmt.Errorf(
		"bad aggregation mode, available modes are: %q",
		common.MapKeys(filterAggregations))
)
View Source
var (
	ErrBadProcessor = fmt.Errorf(
		"bad processor type, available types are: %q",
		common.MapKeys(ProcessorTypes))
)
View Source
var (
	ErrExpressionFieldSize = errors.New("expression: operand size mismatch")
)
View Source
var ProcessorTypes = map[string]Processor{
	"average-cycle": averageCycleProcessor,
	"dummy":         dummyProcessor,
	"expression":    expressionProcessor,
	"filter":        filterProcessor,
	"select":        selectProcessor,
	"resample":      resampleProcessor,
}

ProcessorTypes maps Processor type tags to Processors.

Functions

func DefaultAverageCycleSpec

func DefaultAverageCycleSpec() averageCycleSpec

DefaultAverageCycleSpec returns a averageCycleSpec with 'sensible' default values.

func DefaultExpressionSpec

func DefaultExpressionSpec() expressionSpec

DefaultExpressionSetSpec returns a expressionSetSpec with 'sensible' default values.

func DefaultFilterSetSpec

func DefaultFilterSetSpec() filterSetSpec

DefaultFilterSetSpec returns a filterSetSpec with 'sensible' default values.

func DefaultResampleSpec

func DefaultResampleSpec() resampleSpec

DefaultResampleSpec returns a selectSpec with 'sensible' default values.

func DefaultSelectSpec

func DefaultSelectSpec() selectSpec

DefaultSelectSpec returns a selectSpec with 'sensible' default values.

func Process

func Process(df *dataframe.DataFrame, configs []Config) error

Process applies all Processors defined in the config to df. Each Processor is applied sequentially, in the order they appear in the config, and the result of one Processor is passed as the input to the next one.

An error is returned if any of the Processors return an error. If an error is returned, the dataframe.DataFrame state is unknown.

func SliceArithmetic

func SliceArithmetic() gval.Language

Types

type Config

type Config struct {
	// Type is the name of the processor.
	Type string `yaml:"type"`
	// TypeSpec contains the specification for the processor.
	TypeSpec yaml.Node `yaml:"type_spec"`
}

type Processor

type Processor func(*dataframe.DataFrame, *Config) error

Processor is a function which applies processing on a dataframe.DataFrame based on the configuration.

Jump to

Keyboard shortcuts

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