Documentation
¶
Index ¶
- type Enumerable
- func (e *Enumerable[T]) Count() int
- func (e *Enumerable[T]) Filter(fn func(*T) bool) *Enumerable[T]
- func (e *Enumerable[T]) Map(fn func(*T)) *Enumerable[T]
- func (e *Enumerable[T]) Reduce(fn func(*T, *T) T, starting_point T) T
- func (e *Enumerable[T]) ReduceInt(fn func(*int, *T) int, starting_point int) int
- func (e *Enumerable[T]) ReduceString(fn func(*string, *T) string, starting_point string) string
- func (e *Enumerable[T]) Select(fn func(T) interface{}) (new_list []any)
- func (e *Enumerable[T]) ToList() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enumerable ¶
type Enumerable[T any] struct { // contains filtered or unexported fields }
func ToEnumerable ¶
func ToEnumerable[T any](items []T) Enumerable[T]
func (*Enumerable[T]) Count ¶
func (e *Enumerable[T]) Count() int
returns the number of items in the enumerable
func (*Enumerable[T]) Filter ¶
func (e *Enumerable[T]) Filter(fn func(*T) bool) *Enumerable[T]
Call an anonymous function across each element in your list of items to filter out unwanted items.
func (*Enumerable[T]) Map ¶
func (e *Enumerable[T]) Map(fn func(*T)) *Enumerable[T]
Call an anonymous function across each element in your list of items to change values.
func (*Enumerable[T]) Reduce ¶
func (e *Enumerable[T]) Reduce(fn func(*T, *T) T, starting_point T) T
Squash your list of items into the same type using a criteria specified in a callback method using a starting value.
- Outputs a value unlike the rest of the functional methods in this package
func (*Enumerable[T]) ReduceInt ¶
func (e *Enumerable[T]) ReduceInt(fn func(*int, *T) int, starting_point int) int
Squash your list of items into a single integer using a criteria specified in a callback method using a starting value.
- Outputs a value unlike the rest of the functional methods in this package
func (*Enumerable[T]) ReduceString ¶
func (e *Enumerable[T]) ReduceString(fn func(*string, *T) string, starting_point string) string
Squash your list of items into a single string using a criteria specified in a callback method using a starting value.
- Outputs a value unlike the rest of the functional methods in this package
func (*Enumerable[T]) Select ¶
func (e *Enumerable[T]) Select(fn func(T) interface{}) (new_list []any)
From C# works similarly to Map but instead returns a new value Call an anonymous function across each element in your list of items to change values.
func (*Enumerable[T]) ToList ¶
func (e *Enumerable[T]) ToList() []T