filters

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFilterSpec

type BaseFilterSpec[ListT any] struct {
	SpecName  string
	FormField fields.Field
	Apply     func(value interface{}, objectList []ListT) error
}

func (*BaseFilterSpec[ListT]) Field

func (b *BaseFilterSpec[ListT]) Field() fields.Field

func (*BaseFilterSpec[ListT]) Filter

func (b *BaseFilterSpec[ListT]) Filter(value interface{}, objectList []ListT) error

func (*BaseFilterSpec[ListT]) Name

func (b *BaseFilterSpec[ListT]) Name() string

type FilterSpec

type FilterSpec[ListT any] interface {
	// Name returns the name of the filter.
	Name() string

	// Field returns the field of the filter.
	Field() fields.Field

	// Filter filters the object list.
	Filter(value interface{}, objectList []ListT) error
}

type Filters

type Filters[ListT any] struct {
	// contains filtered or unexported fields
}

func NewFilters

func NewFilters[ListT any](formPrefix string, specs ...FilterSpec[ListT]) *Filters[ListT]

func (*Filters[ListT]) Add

func (f *Filters[ListT]) Add(spec FilterSpec[ListT])

func (*Filters[ListT]) Filter

func (f *Filters[ListT]) Filter(data map[string][]string, objects []ListT) error

func (*Filters[ListT]) Form

func (f *Filters[ListT]) Form() *forms.BaseForm

func (*Filters[ListT]) Specs

func (f *Filters[ListT]) Specs() *orderedmap.OrderedMap[string, FilterSpec[ListT]]

Jump to

Keyboard shortcuts

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