Documentation
¶
Index ¶
- type Selector
- func (s *Selector[T]) Append(item T)
- func (s *Selector[T]) Get(i int) T
- func (s *Selector[T]) Index() int
- func (s *Selector[T]) Next()
- func (s *Selector[T]) OnFirst() bool
- func (s *Selector[T]) OnLast() bool
- func (s *Selector[T]) Prev()
- func (s *Selector[T]) Range(f func(i int, item T) bool)
- func (s *Selector[T]) ReverseRange(f func(i int, item T) bool)
- func (s *Selector[T]) Selected() T
- func (s *Selector[T]) Set(i int, item T)
- func (s *Selector[T]) SetIndex(i int)
- func (s *Selector[T]) Total() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Selector ¶
type Selector[T any] struct { // contains filtered or unexported fields }
Selector is a helper type for selecting items.
func NewSelector ¶
NewSelector creates a new item selector.
func (*Selector[T]) Append ¶
func (s *Selector[T]) Append(item T)
Append adds an item to the selector.
func (*Selector[T]) Prev ¶
func (s *Selector[T]) Prev()
Prev moves the selector to the previous item.
func (*Selector[T]) Range ¶
Range iterates over the items. The callback function should return true to continue the iteration.
func (*Selector[T]) ReverseRange ¶
ReverseRange iterates over the items in reverse. The callback function should return true to continue the iteration.
func (*Selector[T]) Selected ¶
func (s *Selector[T]) Selected() T
Selected returns the index of the current selected item.
Click to show internal directories.
Click to hide internal directories.