extractor

package
v0.0.0-...-e5aba8a Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RuleMappingTypeField       = RuleMappingType("field")
	RuleMappingTypeTag         = RuleMappingType("tag")
	RuleMappingTypeHiddenValue = RuleMappingType("hidden")
)
View Source
var (
	RuleMappingFieldDataTypeFloat   = RuleMappingFieldDataType("float")
	RuleMappingFieldDataTypeInteger = RuleMappingFieldDataType("integer")
	RuleMappingFieldDataTypeString  = RuleMappingFieldDataType("string")
	RuleMappingFieldDataTypeBoolean = RuleMappingFieldDataType("boolean")
)
View Source
var (
	RuleTypeRegexp = RuleType("regexp")
)
View Source
var (
	TargetTypeBody = TargetType("body")
)

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	Query string
	Rules []AggregationRule
	Tags  map[string]string
}

type AggregationRule

type AggregationRule struct {
	Type RuleType

	Target        TargetType
	Pattern       string
	MatchMaxCount int
	Mappings      map[string]RuleMapping
	Replacers     Replacers
}

type Extractor

type Extractor struct {
	Query   string
	Convert func(*gmail.Message) ([]influxdb.Point, error)
}

func List

func List(
	measurements []Measurement,
) ([]Extractor, error)

type Measurement

type Measurement struct {
	Name         string
	Query        string
	Aggregations []Aggregation
}

type Replacer

type Replacer struct {
	Old string `json:"old"`
	New string `json:"new"`
}

func (*Replacer) Apply

func (r *Replacer) Apply(s string) string

type Replacers

type Replacers []Replacer

func (Replacers) Apply

func (rs Replacers) Apply(s string) string

type RuleMapping

type RuleMapping struct {
	Type       RuleMappingType          `json:"type"`
	DataType   RuleMappingFieldDataType `json:"dataType"`
	Replacers  Replacers                `json:"replacers"`
	Expression string                   `json:"expression"`
}

func (*RuleMapping) ExpressionFields

func (m *RuleMapping) ExpressionFields() []string

func (*RuleMapping) FieldValue

func (m *RuleMapping) FieldValue(
	raw string,
	oldValue any,
	fields map[string]any,
	hiddenValues map[string]any,
) (any, error)

func (*RuleMapping) Replace

func (m *RuleMapping) Replace(s string) string

type RuleMappingFieldDataType

type RuleMappingFieldDataType string

type RuleMappingType

type RuleMappingType string

type RuleType

type RuleType string

type TargetType

type TargetType string

Jump to

Keyboard shortcuts

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