metadata

package
v4.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExcludeFilterFields

func ExcludeFilterFields() docs.FieldSpecs

ExcludeFilterFields returns a docs spec for the fields within a metadata config struct.

func IncludeFilterDocs

func IncludeFilterDocs() docs.FieldSpecs

IncludeFilterDocs returns a docs spec for a metadata filter where keys are ignored by default and must be explicitly included.

Types

type ExcludeFilter

type ExcludeFilter struct {
	// contains filtered or unexported fields
}

ExcludeFilter provides a way to filter metadata keys based on a Metadata config.

func (*ExcludeFilter) Iter

func (f *ExcludeFilter) Iter(m *message.Part, fn func(k, v string) error) error

Iter applies a function to each metadata key value pair that passes the filter.

type ExcludeFilterConfig

type ExcludeFilterConfig struct {
	ExcludePrefixes []string `json:"exclude_prefixes" yaml:"exclude_prefixes"`
}

ExcludeFilterConfig describes actions to be performed on message metadata before being sent to an output destination.

func NewExcludeFilterConfig

func NewExcludeFilterConfig() ExcludeFilterConfig

NewExcludeFilterConfig returns a Metadata configuration struct with default values.

func (ExcludeFilterConfig) Filter

func (m ExcludeFilterConfig) Filter() (*ExcludeFilter, error)

Filter attempts to construct a metadata filter.

type IncludeFilter

type IncludeFilter struct {
	// contains filtered or unexported fields
}

IncludeFilter provides a way to filter keys based on a Config.

func (*IncludeFilter) IsSet

func (f *IncludeFilter) IsSet() bool

IsSet returns true if there are any rules configured for matching keys.

func (*IncludeFilter) Iter

func (f *IncludeFilter) Iter(m *message.Part, fn func(k, v string) error) error

Iter applies a function to each metadata key value pair that passes the filter.

func (*IncludeFilter) Match

func (f *IncludeFilter) Match(str string) bool

Match returns true if the provided string matches the configured filters and false otherwise. It also returns false if no filters are configured.

type IncludeFilterConfig

type IncludeFilterConfig struct {
	IncludePrefixes []string `json:"include_prefixes" yaml:"include_prefixes"`
	IncludePatterns []string `json:"include_patterns" yaml:"include_patterns"`
}

IncludeFilterConfig contains configuration fields for a metadata filter where keys are ignored by default and must be explicitly included.

func NewIncludeFilterConfig

func NewIncludeFilterConfig() IncludeFilterConfig

NewIncludeFilterConfig returns an IncludeFilterConfig struct with default values.

func (IncludeFilterConfig) CreateFilter

func (c IncludeFilterConfig) CreateFilter() (*IncludeFilter, error)

CreateFilter attempts to construct a filter object.

Jump to

Keyboard shortcuts

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