filter

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter[T any] interface {
	Apply(...T) []T
}

Filter is a generic interface for a filter that is applied to a slice of type 'T' and returns a subset of the original input as []T

func NewSimpleFilter

func NewSimpleFilter[T any](predicates ...predicate.Predicate[T]) Filter[T]

NewSimpleFilter returns a SimpleFilter matching each supplied predicate.Predicate sequentially on a per-input basis

type SimpleFilter

type SimpleFilter[T any] struct {
	Predicate predicate.Predicate[T]
}

SimpleFilter is a filter that filters based on a supplied predicate (Predicate)

func (SimpleFilter[T]) Apply

func (f SimpleFilter[T]) Apply(inputs ...T) []T

Apply returns the subset of inputs matching the SimpleFilter's Predicate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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