codec

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProductFunc = func(productFunc api.ProductFunc, codec Codec) api.ProductFunc {
	return func(event api.Event) api.Result {
		if codec != nil {
			if _, err := codec.Decode(event); err != nil {
				log.Error("source codec decode failed: %v", err)

			}
		}

		productFunc(event)
		return result.Success()
	}
}

Functions

func Register

func Register(name string, factory Factory)

Types

type Codec

type Codec interface {
	Init()
	Decode(event api.Event) (api.Event, error)
}

func Get

func Get(name string) (Codec, bool)

type Config

type Config struct {
	Type          string `yaml:"type,omitempty" default:"json"`
	cfg.CommonCfg `yaml:",inline"`
}

func (*Config) DeepCopy added in v1.3.0

func (c *Config) DeepCopy() *Config

func (*Config) Merge added in v1.3.0

func (c *Config) Merge(from *Config)

func (*Config) Validate

func (c *Config) Validate() error

type Factory

type Factory func() Codec

type SourceCodec

type SourceCodec interface {
	SetCodec(c Codec)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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