filterset

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package filterset provides an interface for matching strings against a set of string filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MatchType    MatchType      `mapstructure:"match_type"`
	RegexpConfig *regexp.Config `mapstructure:"regexp"`
}

Config configures the matching behavior of a FilterSet.

type FilterSet

type FilterSet interface {
	// Matches returns true if the given string matches at least one
	// of the filters encapsulated by the FilterSet.
	Matches(string) bool
}

FilterSet is an interface for matching strings against a set of filters.

func CreateFilterSet

func CreateFilterSet(filters []string, cfg *Config) (FilterSet, error)

CreateFilterSet creates a FilterSet from yaml config.

type MatchType

type MatchType string

MatchType describes the type of pattern matching a FilterSet uses to filter strings.

const (
	// Regexp is the FilterType for filtering by regexp string matches.
	Regexp MatchType = "regexp"
	// Strict is the FilterType for filtering by exact string matches.
	Strict MatchType = "strict"
	// MatchTypeFieldName is the mapstructure field name for MatchType field.
	MatchTypeFieldName = "match_type"
)

Directories

Path Synopsis
Package regexp provides an implementation to match strings against a set of regexp string filters.
Package regexp provides an implementation to match strings against a set of regexp string filters.
Package strict provides an implementation to match strings against a set of exact match string filters.
Package strict provides an implementation to match strings against a set of exact match string filters.

Jump to

Keyboard shortcuts

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