filter

package
v1.13.11 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Always = &Func{
	Func: func(_ *corev1.Event) bool {
		return true
	},
	Description: "true",
}

Always is a filter that always matches

View Source
var Never = &Func{
	Func: func(_ *corev1.Event) bool {
		return false
	},
	Description: "false",
}

Never is a filter that never matches

Functions

This section is empty.

Types

type Filter

type Filter interface {
	// Match checks if a Event matches the filter
	Match(*corev1.Event) bool
	// Equals compares the Filter with another
	Equals(Filter) bool
	// String returns the description of the Filter
	String() string
}

Filter is an event filters

func New

func New(f func(*corev1.Event) bool, description string) Filter

New creates a new Filter from a filter function: func(*corev1.Event) bool

type Func

type Func struct {
	Func        func(*corev1.Event) bool
	Description string
}

Func is a generic Filter

func (*Func) Equals

func (f *Func) Equals(o Filter) bool

Equals implements Filter interface

func (*Func) Match

func (f *Func) Match(e *corev1.Event) bool

Match implements Filter interface

func (*Func) String

func (f *Func) String() string

type Slice

type Slice []Filter

Slice is a slice of Filter

func (Slice) All

func (s Slice) All() Filter

All creates a new Filter which checks if all Filter in the Slice matches (if the Slice is empty this is equivalent to Always)

func (Slice) Any

func (s Slice) Any() Filter

Any creates a new Filter which checks if least one Filter in the Slice matches (if the Slice is empty this is equivalent to Never)

Jump to

Keyboard shortcuts

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