filter

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package filter provides a generic way to filter a slice of items.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter[T any] struct {
	// contains filtered or unexported fields
}

The Filter contains the slice of items to filter.

func NewFilter

func NewFilter[T any](items []*T) *Filter[T]

NewFilter creates a new filter with the given type and item slice.

func (*Filter[T]) Filter

func (f *Filter[T]) Filter(filters ...func(T) bool) *[]T

Filter executes the filter operation with the given filters functions. Returns a slice of the matching items.

Jump to

Keyboard shortcuts

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