transforms

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransformTypeString = "string"
	TransformTypeLong   = "long"
	TransformTypeFloat  = "float"
)
View Source
const (
	StageBeforeParser = "before_parser"
	StageAfterParser  = "after_parser"
)
View Source
const (
	KeyType = "type"
)

Variables

View Source
var (
	KeyStage = utils.Option{
		KeyName:       "stage",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{StageAfterParser, StageBeforeParser},
		Default:       StageAfterParser,
		DefaultNoUse:  false,
		Description:   "transform运行的阶段(parser前还是parser后)(stage)",
		Type:          TransformTypeString,
	}
	KeyStageAfterOnly = utils.Option{
		KeyName:       "stage",
		ChooseOnly:    true,
		ChooseOptions: []interface{}{StageAfterParser},
		Default:       StageAfterParser,
		DefaultNoUse:  false,
		Description:   "transform运行的阶段(stage)",
		Type:          TransformTypeString,
	}
	KeyFieldName = utils.Option{
		KeyName:      "key",
		ChooseOnly:   false,
		Default:      "my_field_keyname",
		DefaultNoUse: true,
		Description:  "要进行Transform变化的键(key)",
		Type:         TransformTypeString,
	}
	KeyTimezoneoffset = utils.Option{
		KeyName:    "offset",
		ChooseOnly: true,
		ChooseOptions: []interface{}{0, -1, -2, -3, -4,
			-5, -6, -7, -8, -9, -10, -11, -12,
			1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12},
		Default:      "0",
		DefaultNoUse: false,
		Description:  "时区偏移量(offset)",
		CheckRegex:   "*",
		Type:         TransformTypeLong,
	}
)
View Source
var Transformers = map[string]Creator{}

Functions

func Add

func Add(name string, creator Creator)

Types

type Creator

type Creator func() Transformer

type Initialize added in v1.4.1

type Initialize interface {
	Init() error
}

transformer初始化方法接口,err不为空表示初始化失败

type Transformer

type Transformer interface {
	Description() string
	SampleConfig() string
	ConfigOptions() []utils.Option
	Type() string
	Transform([]sender.Data) ([]sender.Data, error)
	RawTransform([]string) ([]string, error)
	Stage() string
	Stats() utils.StatsInfo
}

Transformer plugin做数据变换的接口 注意: transform的规则是,出错要把数据原样返回

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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