filter

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	Find(...T) (T, bool)
}

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

func (SimpleFilter[T]) Find added in v0.7.0

func (f SimpleFilter[T]) Find(inputs ...T) (T, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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