Documentation ¶
Index ¶
- type Collection
- func (c *Collection[T]) Add(items ...T)
- func (c *Collection[T]) All() []T
- func (c *Collection[T]) Contains(item T) bool
- func (c *Collection[T]) Dump()
- func (c *Collection[T]) Each(fn func(T, int))
- func (c *Collection[T]) Exists(item T) bool
- func (c *Collection[T]) Filter(fn func(T, int) bool) *Collection[T]
- func (c *Collection[T]) Find(fn func(T, int) bool) (T, bool)
- func (c *Collection[T]) First() (T, bool)
- func (c *Collection[T]) Has(item T) bool
- func (c *Collection[T]) Index(fn func(T, int) bool) (int, bool)
- func (c *Collection[T]) IsEmpty() bool
- func (c *Collection[T]) IsNotEmpty() bool
- func (c *Collection[T]) Items() []T
- func (c *Collection[T]) Last() (T, bool)
- func (c *Collection[T]) Len() int
- func (c *Collection[T]) Map(fn func(T, int) T) *Collection[T]
- func (c *Collection[T]) Missing(item T) bool
- func (c *Collection[T]) Reduce(fn func(T, T) T) T
- func (c *Collection[T]) Reverse() *Collection[T]
- func (c *Collection[T]) SortBy(fn func(T, T) bool) *Collection[T]
- func (c *Collection[T]) Unique() *Collection[T]
- func (c *Collection[T]) Unless(condition bool, fns ...func(*Collection[T])) *Collection[T]
- func (c *Collection[T]) When(condition bool, fns ...func(*Collection[T])) *Collection[T]
- func (c *Collection[T]) Where(fn func(T, int) bool) *Collection[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection[T comparable] struct { // contains filtered or unexported fields }
func New ¶
func New[T comparable](items []T) *Collection[T]
func (*Collection[T]) Add ¶
func (c *Collection[T]) Add(items ...T)
func (*Collection[T]) All ¶
func (c *Collection[T]) All() []T
func (*Collection[T]) Contains ¶
func (c *Collection[T]) Contains(item T) bool
func (*Collection[T]) Dump ¶ added in v2.6.1
func (c *Collection[T]) Dump()
func (*Collection[T]) Each ¶
func (c *Collection[T]) Each(fn func(T, int))
func (*Collection[T]) Exists ¶
func (c *Collection[T]) Exists(item T) bool
func (*Collection[T]) Filter ¶
func (c *Collection[T]) Filter(fn func(T, int) bool) *Collection[T]
func (*Collection[T]) First ¶
func (c *Collection[T]) First() (T, bool)
func (*Collection[T]) Has ¶
func (c *Collection[T]) Has(item T) bool
func (*Collection[T]) IsEmpty ¶
func (c *Collection[T]) IsEmpty() bool
func (*Collection[T]) IsNotEmpty ¶
func (c *Collection[T]) IsNotEmpty() bool
func (*Collection[T]) Items ¶
func (c *Collection[T]) Items() []T
func (*Collection[T]) Last ¶
func (c *Collection[T]) Last() (T, bool)
func (*Collection[T]) Len ¶
func (c *Collection[T]) Len() int
func (*Collection[T]) Map ¶
func (c *Collection[T]) Map(fn func(T, int) T) *Collection[T]
func (*Collection[T]) Missing ¶
func (c *Collection[T]) Missing(item T) bool
func (*Collection[T]) Reduce ¶
func (c *Collection[T]) Reduce(fn func(T, T) T) T
func (*Collection[T]) Reverse ¶
func (c *Collection[T]) Reverse() *Collection[T]
func (*Collection[T]) SortBy ¶
func (c *Collection[T]) SortBy(fn func(T, T) bool) *Collection[T]
func (*Collection[T]) Unique ¶
func (c *Collection[T]) Unique() *Collection[T]
func (*Collection[T]) Unless ¶ added in v2.8.0
func (c *Collection[T]) Unless(condition bool, fns ...func(*Collection[T])) *Collection[T]
func (*Collection[T]) When ¶ added in v2.8.0
func (c *Collection[T]) When(condition bool, fns ...func(*Collection[T])) *Collection[T]
func (*Collection[T]) Where ¶
func (c *Collection[T]) Where(fn func(T, int) bool) *Collection[T]
Click to show internal directories.
Click to hide internal directories.