filterlist

package
v0.0.0-...-f6f1029 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base[T any] interface {
	/* true if this object contains the given string as a substring */
	Contains(string) bool
	/* true if this object is less than the argument */
	Less(T) bool
	/* some string used to compare elements in sorting */
	SortKey() string
}

type List

type List[E Base[E]] struct {
	// contains filtered or unexported fields
}

func (*List[E]) Add

func (list *List[E]) Add(value E)

Add a new element to the list

func (*List[E]) AddFilter

func (list *List[E]) AddFilter(f string)

add a string to the end of the filter list

func (*List[E]) All

func (list *List[E]) All() []E

Return all the unfiltered elements in the list

func (*List[E]) BackspaceFilter

func (list *List[E]) BackspaceFilter() bool

remove the most recently added letter from the filter string. * returns true if a letter was taken off the filter, or false * if the filter was empty

func (*List[E]) Filter

func (list *List[E]) Filter() string

return the filter string

func (*List[E]) Filtered

func (list *List[E]) Filtered() []E

Return only filtered elements

func (*List[E]) ResetFilter

func (list *List[E]) ResetFilter()

update the filter list in case the underlying filter string has changed

func (*List[E]) Size

func (list *List[E]) Size() int

number of elements in list

type Sortable

type Sortable[E Base[E]] []E

func (Sortable[E]) Len

func (data Sortable[E]) Len() int

func (Sortable[E]) Less

func (data Sortable[E]) Less(left, right int) bool

func (Sortable[E]) Swap

func (data Sortable[E]) Swap(left, right int)

Jump to

Keyboard shortcuts

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