Documentation ¶
Index ¶
- Constants
- type KeyValuePair
- type MapStream
- func (s MapStream[T, V]) All(expression func(KeyValuePair[T, V]) bool) bool
- func (s MapStream[T, V]) Append(item KeyValuePair[T, V]) MapStream[T, V]
- func (s MapStream[T, V]) AppendIf(item KeyValuePair[T, V], c bool) MapStream[T, V]
- func (s MapStream[T, V]) Average(byKey bool) float64
- func (s MapStream[T, V]) Bind(v *map[T]V)
- func (s MapStream[T, V]) Clear() Stream[T]
- func (s MapStream[T, V]) Collect() map[T]V
- func (s MapStream[T, V]) ContainsKey(key T) bool
- func (s MapStream[T, V]) Count() int
- func (s MapStream[T, V]) ElementAt(index int) KeyValuePair[T, V]
- func (s MapStream[T, V]) ElementAtOrElse(index int, elseValue KeyValuePair[T, V]) KeyValuePair[T, V]
- func (s MapStream[T, V]) Filter(expression func(KeyValuePair[T, V]) bool) MapStream[T, V]
- func (s MapStream[T, V]) Find(expression func(item KeyValuePair[T, V]) bool) KeyValuePair[T, V]
- func (s MapStream[T, V]) FindIndex(expression func(item KeyValuePair[T, V]) bool) int
- func (s MapStream[T, V]) FindLast(expression func(item KeyValuePair[T, V]) bool) KeyValuePair[T, V]
- func (s MapStream[T, V]) FindLastIndex(expression func(item KeyValuePair[T, V]) bool) int
- func (s MapStream[T, V]) First() KeyValuePair[T, V]
- func (s MapStream[T, V]) ForEach(expression func(KeyValuePair[T, V]))
- func (s MapStream[T, V]) IsEmpty() bool
- func (s MapStream[T, V]) IsNotEmpty() bool
- func (s MapStream[T, V]) Keys() Stream[T]
- func (s MapStream[T, V]) Last() KeyValuePair[T, V]
- func (s MapStream[T, V]) Map(expression func(item KeyValuePair[T, V]) KeyValuePair[T, V]) MapStream[T, V]
- func (s MapStream[T, V]) Max(byKey bool) KeyValuePair[T, V]
- func (s MapStream[T, V]) MaxIndex(byKey bool) int
- func (s MapStream[T, V]) Min(byKey bool) KeyValuePair[T, V]
- func (s MapStream[T, V]) MinIndex(byKey bool) int
- func (s MapStream[T, V]) OrderBy(byKey bool) MapStream[T, V]
- func (s MapStream[T, V]) OrderByDescending(byKey bool) MapStream[T, V]
- func (s MapStream[T, V]) RemoveKey(key T) MapStream[T, V]
- func (s MapStream[T, V]) RemoveValue(value V) MapStream[T, V]
- func (s MapStream[T, V]) RemoveWhere(expression func(KeyValuePair[T, V]) bool) MapStream[T, V]
- func (s MapStream[T, V]) Shuffle() MapStream[T, V]
- func (s MapStream[T, V]) Some(expression func(item KeyValuePair[T, V]) bool) bool
- func (s MapStream[T, V]) Sum(byKey bool) interface{}
- func (s MapStream[T, V]) Values() Stream[V]
- func (s MapStream[T, V]) Wait(duration time.Duration) MapStream[T, V]
- type Stream
- func (s Stream[T]) All(expression func(T) bool) bool
- func (s Stream[T]) Append(item T) Stream[T]
- func (s Stream[T]) AppendAt(index int, item T) Stream[T]
- func (s Stream[T]) AppendIf(item T, c bool) Stream[T]
- func (s Stream[T]) ArrEquals(arr []T) bool
- func (s Stream[T]) Average() float64
- func (s Stream[T]) BinarySearch(item T) int
- func (s Stream[T]) Bind(v *[]T)
- func (s Stream[T]) Clear() Stream[T]
- func (s Stream[T]) Collect() []T
- func (s Stream[T]) Contains(item T) bool
- func (s Stream[T]) Count() int
- func (s Stream[T]) Distinct() Stream[T]
- func (s Stream[T]) ElementAt(index int) T
- func (s Stream[T]) ElementAtOrElse(index int, elseValue T) T
- func (s Stream[T]) Equals(b Stream[T]) bool
- func (s Stream[T]) Filter(expression func(item T) bool) Stream[T]
- func (s Stream[T]) Find(expression func(item T) bool) T
- func (s Stream[T]) FindIndex(expression func(item T) bool) int
- func (s Stream[T]) FindLast(expression func(item T) bool) T
- func (s Stream[T]) FindLastIndex(expression func(item T) bool) int
- func (s Stream[T]) First() T
- func (s Stream[T]) ForEach(expression func(item T))
- func (s Stream[T]) IndexOf(item T) int
- func (s Stream[T]) IsEmpty() bool
- func (s Stream[T]) IsNotEmpty() bool
- func (s Stream[T]) Join(separator string) string
- func (s Stream[T]) Last() T
- func (s Stream[T]) LastIndexOf(item T) int
- func (s Stream[T]) Limit(amount int) Stream[T]
- func (s Stream[T]) Map(expression func(item T) T) Stream[T]
- func (s Stream[T]) Max() T
- func (s Stream[T]) MaxIndex() int
- func (s Stream[T]) Min() T
- func (s Stream[T]) MinIndex() int
- func (s Stream[T]) OrderBy() Stream[T]
- func (s Stream[T]) OrderByDescending() Stream[T]
- func (s Stream[T]) Push(arr []T) Stream[T]
- func (s Stream[T]) PushValues(values ...T) Stream[T]
- func (s Stream[T]) Remove(item T) Stream[T]
- func (s Stream[T]) RemoveAt(index int) Stream[T]
- func (s Stream[T]) RemoveDuplicates() Stream[T]
- func (s Stream[T]) RemoveIf(item T, c bool) Stream[T]
- func (s Stream[T]) RemoveWhere(expression func(item T) bool) Stream[T]
- func (s Stream[T]) Replace(from T, to T) Stream[T]
- func (s Stream[T]) ReplaceWhere(function func(item T) bool, to T) Stream[T]
- func (s Stream[T]) Reverse() Stream[T]
- func (s Stream[T]) Shuffle() Stream[T]
- func (s Stream[T]) Skip(amount int) Stream[T]
- func (s Stream[T]) Slice(start int, end int) Stream[T]
- func (s Stream[T]) Some(expression func(item T) bool) bool
- func (s Stream[T]) Sum() T
- func (s Stream[T]) Wait(duration time.Duration) Stream[T]
- type Streamable
- type StructStream
- func (s StructStream[T]) All(expression func(T) bool) bool
- func (s StructStream[T]) Append(item T) StructStream[T]
- func (s StructStream[T]) AppendAt(index int, item T) StructStream[T]
- func (s StructStream[T]) AppendIf(item T, c bool) StructStream[T]
- func (s StructStream[T]) ArrEquals(arr []T) bool
- func (s StructStream[T]) Average(fieldName string) float64
- func (s StructStream[T]) Bind(v *[]T)
- func (s StructStream[T]) Clear() StructStream[T]
- func (s StructStream[T]) Collect() []T
- func (s StructStream[T]) Contains(item T) bool
- func (s StructStream[T]) Count() int
- func (s StructStream[T]) ElementAt(index int) T
- func (s StructStream[T]) ElementAtOrElse(index int, elseValue T) T
- func (s StructStream[T]) Equals(b StructStream[T]) bool
- func (s StructStream[T]) Filter(expression func(item T) bool) StructStream[T]
- func (s StructStream[T]) Find(expression func(item T) bool) T
- func (s StructStream[T]) FindIndex(expression func(item T) bool) int
- func (s StructStream[T]) FindLast(expression func(item T) bool) T
- func (s StructStream[T]) FindLastIndex(expression func(item T) bool) int
- func (s StructStream[T]) First() T
- func (s StructStream[T]) ForEach(expression func(item T))
- func (s StructStream[T]) IndexOf(item T) int
- func (s StructStream[T]) IsEmpty() bool
- func (s StructStream[T]) IsNotEmpty() bool
- func (s StructStream[T]) Last() T
- func (s StructStream[T]) LastIndexOf(item T) int
- func (s StructStream[T]) Limit(amount int) StructStream[T]
- func (s StructStream[T]) Map(expression func(item T) T) StructStream[T]
- func (s StructStream[T]) Max(fieldName string) T
- func (s StructStream[T]) MaxIndex(fieldName string) int
- func (s StructStream[T]) Min(fieldName string) T
- func (s StructStream[T]) MinIndex(fieldName string) int
- func (s StructStream[T]) OrderBy(fieldName string) StructStream[T]
- func (s StructStream[T]) OrderByDescending(fieldName string) StructStream[T]
- func (s StructStream[T]) Push(arr []T) StructStream[T]
- func (s StructStream[T]) PushValues(values ...T) StructStream[T]
- func (s StructStream[T]) Remove(item T) StructStream[T]
- func (s StructStream[T]) RemoveAt(index int) StructStream[T]
- func (s StructStream[T]) RemoveIf(item T, c bool) StructStream[T]
- func (s StructStream[T]) RemoveWhere(expression func(item T) bool) StructStream[T]
- func (s StructStream[T]) Replace(from T, to T) StructStream[T]
- func (s StructStream[T]) ReplaceWhere(function func(item T) bool, to T) StructStream[T]
- func (s StructStream[T]) Reverse() StructStream[T]
- func (s StructStream[T]) Shuffle() StructStream[T]
- func (s StructStream[T]) Skip(amount int) StructStream[T]
- func (s StructStream[T]) Slice(start int, end int) StructStream[T]
- func (s StructStream[T]) Some(expression func(item T) bool) bool
- func (s StructStream[T]) Sum(fieldName string) float64
- func (s StructStream[T]) Wait(duration time.Duration) StructStream[T]
Constants ¶
const ByKey bool = true
const ByValue bool = false
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyValuePair ¶ added in v1.3.0
type KeyValuePair[T Streamable, V Streamable] struct { Key T Value V }
type MapStream ¶ added in v1.3.0
type MapStream[T Streamable, V Streamable] struct { Array []KeyValuePair[T, V] }
func EmptyMap ¶ added in v1.3.0
func EmptyMap[T Streamable, V Streamable]() MapStream[T, V]
The EmptyMap function creates a new empty stream for maps.
func FromMap ¶ added in v1.3.0
func FromMap[T Streamable, V Streamable](m map[T]V) MapStream[T, V]
The FromMap function creates a new stream from the given map.
func (MapStream[T, V]) All ¶ added in v1.3.0
func (s MapStream[T, V]) All(expression func(KeyValuePair[T, V]) bool) bool
The All function determines whether all elements of the stream satisfy the passed condition.
func (MapStream[T, V]) Append ¶ added in v1.3.0
func (s MapStream[T, V]) Append(item KeyValuePair[T, V]) MapStream[T, V]
The Append function adds an element to the stream.
func (MapStream[T, V]) AppendIf ¶ added in v1.3.0
func (s MapStream[T, V]) AppendIf(item KeyValuePair[T, V], c bool) MapStream[T, V]
The AppendIf function adds an element to the stream if the second parameter is true.
func (MapStream[T, V]) Average ¶ added in v1.3.0
The Average function calculates the average of the stream. This function doesn't work with strings.
func (MapStream[T, V]) Bind ¶ added in v1.3.1
func (s MapStream[T, V]) Bind(v *map[T]V)
The Bind function binds the stream into the passed variable.
func (MapStream[T, V]) Clear ¶ added in v1.3.0
The Clear function clears every element from the stream.
func (MapStream[T, V]) Collect ¶ added in v1.3.0
func (s MapStream[T, V]) Collect() map[T]V
The Collect function returns the modified map from the streams.
func (MapStream[T, V]) ContainsKey ¶ added in v1.3.0
The ContainsKey function checks whether the stream contains an item with the passed key.
func (MapStream[T, V]) Count ¶ added in v1.3.0
The Count function returns the count of elements in the stream.
func (MapStream[T, V]) ElementAt ¶ added in v1.3.0
func (s MapStream[T, V]) ElementAt(index int) KeyValuePair[T, V]
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it throws a panic.
func (MapStream[T, V]) ElementAtOrElse ¶ added in v1.3.0
func (s MapStream[T, V]) ElementAtOrElse(index int, elseValue KeyValuePair[T, V]) KeyValuePair[T, V]
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it returns the elseValue, which is the second parameter.
func (MapStream[T, V]) Filter ¶ added in v1.3.0
func (s MapStream[T, V]) Filter(expression func(KeyValuePair[T, V]) bool) MapStream[T, V]
The Filter function leaves only those elements in the array that make the specified condition true.
func (MapStream[T, V]) Find ¶ added in v1.3.0
func (s MapStream[T, V]) Find(expression func(item KeyValuePair[T, V]) bool) KeyValuePair[T, V]
The Find function searches for an element that matches the conditions passed and returns the first occurrence within the entire stream.
func (MapStream[T, V]) FindIndex ¶ added in v1.3.0
func (s MapStream[T, V]) FindIndex(expression func(item KeyValuePair[T, V]) bool) int
The FindIndex function searches for an element that matches the conditions passed and returns the index of the first occurrence within the entire stream.
func (MapStream[T, V]) FindLast ¶ added in v1.3.0
func (s MapStream[T, V]) FindLast(expression func(item KeyValuePair[T, V]) bool) KeyValuePair[T, V]
The FindLast function searches for an element that matches the conditions passed and returns the last occurrence within the entire stream.
func (MapStream[T, V]) FindLastIndex ¶ added in v1.3.0
func (s MapStream[T, V]) FindLastIndex(expression func(item KeyValuePair[T, V]) bool) int
The FindLastIndex function searches for an element that matches the conditions passed and returns the index of the last occurrence within the entire stream.
func (MapStream[T, V]) First ¶ added in v1.3.0
func (s MapStream[T, V]) First() KeyValuePair[T, V]
The First method returns the first element in the stream.
func (MapStream[T, V]) ForEach ¶ added in v1.3.0
func (s MapStream[T, V]) ForEach(expression func(KeyValuePair[T, V]))
The ForEach method runs the specified method with every element in the Stream.
func (MapStream[T, V]) IsEmpty ¶ added in v1.3.0
The IsEmpty function checks whether the stream is empty.
func (MapStream[T, V]) IsNotEmpty ¶ added in v1.3.0
The IsNotEmpty function checks whether the stream is not empty.
func (MapStream[T, V]) Keys ¶ added in v1.3.2
The Keys function returns a new stream of the keys of the map.
func (MapStream[T, V]) Last ¶ added in v1.3.0
func (s MapStream[T, V]) Last() KeyValuePair[T, V]
The Last method returns the last element in the stream.
func (MapStream[T, V]) Map ¶ added in v1.3.0
func (s MapStream[T, V]) Map(expression func(item KeyValuePair[T, V]) KeyValuePair[T, V]) MapStream[T, V]
The Map function creates a new stream populated with the results of calling the provided function on every element.
func (MapStream[T, V]) Max ¶ added in v1.3.0
func (s MapStream[T, V]) Max(byKey bool) KeyValuePair[T, V]
The Max function returns the largest element from the stream.
func (MapStream[T, V]) MaxIndex ¶ added in v1.3.0
The MaxIndex function returns the index of the largest element from the stream.
func (MapStream[T, V]) Min ¶ added in v1.3.0
func (s MapStream[T, V]) Min(byKey bool) KeyValuePair[T, V]
The Min function returns the smallest element from the stream.
func (MapStream[T, V]) MinIndex ¶ added in v1.3.0
The MinIndex function returns the index of the smallest element from the stream.
func (MapStream[T, V]) OrderBy ¶ added in v1.3.0
The OrderBy function sorts the stream in ascending order.
func (MapStream[T, V]) OrderByDescending ¶ added in v1.3.0
The OrderByDescending function sorts the stream in descending order.
func (MapStream[T, V]) RemoveKey ¶ added in v1.3.0
The RemoveKey function removes every element from a stream where the key is equal to the passed item.
func (MapStream[T, V]) RemoveValue ¶ added in v1.3.0
The RemoveValue function removes every element from a stream where the value is equal to the passed item.
func (MapStream[T, V]) RemoveWhere ¶ added in v1.3.0
func (s MapStream[T, V]) RemoveWhere(expression func(KeyValuePair[T, V]) bool) MapStream[T, V]
The RemoveWhere function removes all the entries that satisfy the provided condition.
func (MapStream[T, V]) Some ¶ added in v1.3.0
func (s MapStream[T, V]) Some(expression func(item KeyValuePair[T, V]) bool) bool
The Some function determines whether any of the elements of the stream satisfy the passed condition.
type Stream ¶
type Stream[T Streamable] struct { Array []T }
func Empty ¶ added in v1.1.0
func Empty[T Streamable]() Stream[T]
The Empty function returns an empty stream.
func FromArray ¶
func FromArray[T Streamable](array []T) Stream[T]
The FromArray function creates a new stream from the given array.
func FromFile ¶ added in v1.2.0
The FromFile function creates a stream from a file. The file is read line by line. Each line is an element of the stream.
func FromValues ¶ added in v1.1.0
func FromValues[T Streamable](values ...T) Stream[T]
The FromValues function returns a stream made of the specified parameters.
func (Stream[T]) All ¶ added in v1.1.0
The All function determines whether all elements of the stream satisfy the passed condition.
func (Stream[T]) AppendAt ¶
The AppendAt function inserts the specified element at the specified position in the stream.
func (Stream[T]) AppendIf ¶ added in v1.1.0
The AppendIf function adds an element to the stream if the second parameter is true.
func (Stream[T]) ArrEquals ¶ added in v1.1.0
The ArrEquals function compares the stream and the passed array and returns true if they're equals.
func (Stream[T]) Average ¶ added in v1.1.0
The Average function calculates the average of the stream. This function doesn't work with strings.
func (Stream[T]) BinarySearch ¶ added in v1.2.3
The BinarySearch function finds the index of a target value within a sorted stream.
func (Stream[T]) Bind ¶ added in v1.3.1
func (s Stream[T]) Bind(v *[]T)
The Bind function binds the stream into the passed variable.
func (Stream[T]) Collect ¶
func (s Stream[T]) Collect() []T
The Collect function returns the modified array from the streams.
func (Stream[T]) Contains ¶
The Contains function checks whether the stream contains the passed item.
func (Stream[T]) Distinct ¶ added in v1.1.0
The Distinct function filters every distinct element from the stream.
func (Stream[T]) ElementAt ¶ added in v1.1.0
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it throws a panic.
func (Stream[T]) ElementAtOrElse ¶ added in v1.1.0
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it returns the elseValue, which is the second parameter.
func (Stream[T]) Equals ¶ added in v1.1.0
The Equals function compares two streams and returns true if they're equals.
func (Stream[T]) Filter ¶
The Filter function leaves only those elements in the array that make the specified condition true.
func (Stream[T]) Find ¶ added in v1.1.0
The Find function searches for an element that matches the conditions passed and returns the first occurrence within the entire stream.
func (Stream[T]) FindIndex ¶ added in v1.1.0
The FindIndex function searches for an element that matches the conditions passed and returns the index of the first occurrence within the entire stream.
func (Stream[T]) FindLast ¶ added in v1.1.0
The FindLast function searches for an element that matches the conditions passed and returns the last occurrence within the entire stream.
func (Stream[T]) FindLastIndex ¶ added in v1.1.0
The FindLastIndex function searches for an element that matches the conditions passed and returns the index of the last occurrence within the entire stream.
func (Stream[T]) First ¶ added in v1.2.1
func (s Stream[T]) First() T
The First method returns the first element in the stream.
func (Stream[T]) ForEach ¶
func (s Stream[T]) ForEach(expression func(item T))
The ForEach method runs the specified method with every element in the Stream.
func (Stream[T]) IndexOf ¶ added in v1.1.0
The IndexOf function returns the position of the first occurrence of the passed value in a stream.
func (Stream[T]) IsNotEmpty ¶ added in v1.2.1
The IsNotEmpty function checks whether the stream is not empty.
func (Stream[T]) Join ¶
Join concatenates the elements of the stream to create a single string. The passed parameter is placed between the elements.
func (Stream[T]) Last ¶ added in v1.2.1
func (s Stream[T]) Last() T
The Last method returns the last element in the stream.
func (Stream[T]) LastIndexOf ¶ added in v1.1.0
The LastIndexOf function returns the position of the last occurrence of the passed value in a stream.
func (Stream[T]) Limit ¶
The Limit function constrains the number of elements returned by the stream.
func (Stream[T]) Map ¶
The Map function creates a new stream populated with the results of calling the provided function on every element.
func (Stream[T]) Max ¶ added in v1.1.0
func (s Stream[T]) Max() T
The Max function returns the largest element from the stream.
func (Stream[T]) MaxIndex ¶ added in v1.1.0
The MaxIndex function returns the index of the largest element from the stream.
func (Stream[T]) Min ¶ added in v1.1.0
func (s Stream[T]) Min() T
The Min function returns the smallest element from the stream.
func (Stream[T]) MinIndex ¶ added in v1.1.0
The MinIndex function returns the index of the smallest element from the stream.
func (Stream[T]) OrderByDescending ¶
The OrderByDescending function sorts the stream in descending order.
func (Stream[T]) Push ¶ added in v1.2.3
The Push function adds the passed array to the end of the stream.
func (Stream[T]) PushValues ¶ added in v1.2.3
The PushValues function adds the passed values to the end of the stream.
func (Stream[T]) RemoveAt ¶
The RemoveAt function removes the item if its index matches the index passed in.
func (Stream[T]) RemoveDuplicates ¶
The RemoveDuplicates function removes every duplicate item from the stream.
func (Stream[T]) RemoveIf ¶ added in v1.1.0
The RemoveIf function removes the passed element from a stream if the second parameter is true.
func (Stream[T]) RemoveWhere ¶
The RemoveWhere function removes all the entries that satisfy the provided condition.
func (Stream[T]) Replace ¶ added in v1.2.2
The Replace function replaces every occurrence of 'from' to 'to'. The first parameter is 'from', and the second is 'to'.
func (Stream[T]) ReplaceWhere ¶ added in v1.2.2
The ReplaceWhere function replaces every element that satisfies the condition.
func (Stream[T]) Skip ¶ added in v1.3.1
The Skip function discards the first n elements of a stream, where n is the passed parameter.
func (Stream[T]) Slice ¶ added in v1.2.2
The Slice function returns a copy of a portion of a stream into a new stream selected from start to end (end not included) where start and end represent the index of items in the stream.
func (Stream[T]) Some ¶ added in v1.1.0
The Some function determines whether any of the elements of the stream satisfy the passed condition.
type Streamable ¶
type Streamable interface { string | byte | float32 | float64 | int | int16 | int32 | int64 | uint16 | uint32 | uint64 }
The Streamable interface defines every type you can use the streams with.
type StructStream ¶ added in v1.2.0
type StructStream[T interface{}] struct {
Array []T
}
func FromStructs ¶ added in v1.2.0
func FromStructs[T interface{}](array []T) StructStream[T]
The FromStruct function creates a new stream from the given struct array. If the given array is not made of struct, it throws an error.
func (StructStream[T]) All ¶ added in v1.2.0
func (s StructStream[T]) All(expression func(T) bool) bool
The All function determines whether all elements of the stream satisfy the passed condition.
func (StructStream[T]) Append ¶ added in v1.2.0
func (s StructStream[T]) Append(item T) StructStream[T]
The Append function adds an element to the stream.
func (StructStream[T]) AppendAt ¶ added in v1.2.0
func (s StructStream[T]) AppendAt(index int, item T) StructStream[T]
The AppendAt function inserts the specified element at the specified position in the stream.
func (StructStream[T]) AppendIf ¶ added in v1.2.0
func (s StructStream[T]) AppendIf(item T, c bool) StructStream[T]
The AppendIf function adds an element to the stream if the second parameter is true.
func (StructStream[T]) ArrEquals ¶ added in v1.2.0
func (s StructStream[T]) ArrEquals(arr []T) bool
The ArrEquals function compares the stream and the passed array and returns true if they're equals.
func (StructStream[T]) Average ¶ added in v1.2.0
func (s StructStream[T]) Average(fieldName string) float64
The Average function calculates the average of the stream. This function doesn't work with strings. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) Bind ¶ added in v1.3.1
func (s StructStream[T]) Bind(v *[]T)
The Bind function binds the stream into the passed variable.
func (StructStream[T]) Clear ¶ added in v1.2.0
func (s StructStream[T]) Clear() StructStream[T]
The Clear function clears every element from the stream.
func (StructStream[T]) Collect ¶ added in v1.2.0
func (s StructStream[T]) Collect() []T
The Collect function returns the modified array from the streams.
func (StructStream[T]) Contains ¶ added in v1.2.0
func (s StructStream[T]) Contains(item T) bool
The Contains function checks whether the stream contains the passed item.
func (StructStream[T]) Count ¶ added in v1.2.0
func (s StructStream[T]) Count() int
The Count function returns the count of elements in the stream.
func (StructStream[T]) ElementAt ¶ added in v1.2.0
func (s StructStream[T]) ElementAt(index int) T
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it throws a panic.
func (StructStream[T]) ElementAtOrElse ¶ added in v1.2.0
func (s StructStream[T]) ElementAtOrElse(index int, elseValue T) T
The ElementAt function is used to get an element from the stream at a particular index. If the element is not present, it returns the elseValue, which is the second parameter.
func (StructStream[T]) Equals ¶ added in v1.2.0
func (s StructStream[T]) Equals(b StructStream[T]) bool
The Equals function compares two streams and returns true if they're equals.
func (StructStream[T]) Filter ¶ added in v1.2.0
func (s StructStream[T]) Filter(expression func(item T) bool) StructStream[T]
The Filter function leaves only those elements in the array that make the specified condition true.
func (StructStream[T]) Find ¶ added in v1.2.0
func (s StructStream[T]) Find(expression func(item T) bool) T
The Find function searches for an element that matches the conditions passed and returns the first occurrence within the entire stream.
func (StructStream[T]) FindIndex ¶ added in v1.2.0
func (s StructStream[T]) FindIndex(expression func(item T) bool) int
The FindIndex function searches for an element that matches the conditions passed and returns the index of the first occurrence within the entire stream.
func (StructStream[T]) FindLast ¶ added in v1.2.0
func (s StructStream[T]) FindLast(expression func(item T) bool) T
The FindLast function searches for an element that matches the conditions passed and returns the last occurrence within the entire stream.
func (StructStream[T]) FindLastIndex ¶ added in v1.2.0
func (s StructStream[T]) FindLastIndex(expression func(item T) bool) int
The FindLastIndex function searches for an element that matches the conditions passed and returns the index of the last occurrence within the entire stream.
func (StructStream[T]) First ¶ added in v1.2.1
func (s StructStream[T]) First() T
The First method returns the first element in the stream.
func (StructStream[T]) ForEach ¶ added in v1.2.0
func (s StructStream[T]) ForEach(expression func(item T))
The ForEach method runs the specified method with every element in the Stream.
func (StructStream[T]) IndexOf ¶ added in v1.2.0
func (s StructStream[T]) IndexOf(item T) int
The IndexOf function returns the position of the first occurrence of the passed value in a stream.
func (StructStream[T]) IsEmpty ¶ added in v1.2.0
func (s StructStream[T]) IsEmpty() bool
The IsEmpty function checks whether the stream is empty.
func (StructStream[T]) IsNotEmpty ¶ added in v1.2.1
func (s StructStream[T]) IsNotEmpty() bool
The IsNotEmpty function checks whether the stream is not empty.
func (StructStream[T]) Last ¶ added in v1.2.1
func (s StructStream[T]) Last() T
The Last method returns the last element in the stream.
func (StructStream[T]) LastIndexOf ¶ added in v1.2.0
func (s StructStream[T]) LastIndexOf(item T) int
The LastIndexOf function returns the position of the last occurrence of the passed value in a stream.
func (StructStream[T]) Limit ¶ added in v1.2.0
func (s StructStream[T]) Limit(amount int) StructStream[T]
The Limit function constrains the number of elements returned by the stream.
func (StructStream[T]) Map ¶ added in v1.2.0
func (s StructStream[T]) Map(expression func(item T) T) StructStream[T]
The Map function creates a new stream populated with the results of calling the provided function on every element.
func (StructStream[T]) Max ¶ added in v1.2.0
func (s StructStream[T]) Max(fieldName string) T
The Max function returns the largest element from the stream. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) MaxIndex ¶ added in v1.2.0
func (s StructStream[T]) MaxIndex(fieldName string) int
The MaxIndex function returns the index of the largest element from the stream. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) Min ¶ added in v1.2.0
func (s StructStream[T]) Min(fieldName string) T
The Min function returns the smallest element from the stream. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) MinIndex ¶ added in v1.2.0
func (s StructStream[T]) MinIndex(fieldName string) int
The MinIndex function returns the index of the smallest element from the stream. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) OrderBy ¶ added in v1.2.0
func (s StructStream[T]) OrderBy(fieldName string) StructStream[T]
The OrderBy function sorts the stream in ascending order. The first parameter is the name of the field you want to sort by.
func (StructStream[T]) OrderByDescending ¶ added in v1.2.0
func (s StructStream[T]) OrderByDescending(fieldName string) StructStream[T]
The OrderByDescending function sorts the stream in descending order The first parameter is the name of the field you want to sort by.
func (StructStream[T]) Push ¶ added in v1.2.3
func (s StructStream[T]) Push(arr []T) StructStream[T]
The Push function adds the passed array to the end of the stream.
func (StructStream[T]) PushValues ¶ added in v1.2.3
func (s StructStream[T]) PushValues(values ...T) StructStream[T]
The PushValues function adds the passed values to the end of the stream.
func (StructStream[T]) Remove ¶ added in v1.2.0
func (s StructStream[T]) Remove(item T) StructStream[T]
The Remove function removes the passed element from a stream.
func (StructStream[T]) RemoveAt ¶ added in v1.2.0
func (s StructStream[T]) RemoveAt(index int) StructStream[T]
The RemoveAt function removes the item if its index matches the index passed in.
func (StructStream[T]) RemoveIf ¶ added in v1.2.0
func (s StructStream[T]) RemoveIf(item T, c bool) StructStream[T]
The RemoveIf function removes the passed element from a stream if the second parameter is true.
func (StructStream[T]) RemoveWhere ¶ added in v1.2.0
func (s StructStream[T]) RemoveWhere(expression func(item T) bool) StructStream[T]
The RemoveWhere function removes all the entries that satisfy the provided condition.
func (StructStream[T]) Replace ¶ added in v1.2.2
func (s StructStream[T]) Replace(from T, to T) StructStream[T]
The Replace function replaces every occurrence of 'from' to 'to'. The first parameter is 'from', and the second is 'to'.
func (StructStream[T]) ReplaceWhere ¶ added in v1.2.2
func (s StructStream[T]) ReplaceWhere(function func(item T) bool, to T) StructStream[T]
The ReplaceWhere function replaces every element that satisfies the condition.
func (StructStream[T]) Reverse ¶ added in v1.2.0
func (s StructStream[T]) Reverse() StructStream[T]
The Reverse function reverses the stream.
func (StructStream[T]) Shuffle ¶ added in v1.2.1
func (s StructStream[T]) Shuffle() StructStream[T]
The Shuffle function shuffles the stream.
func (StructStream[T]) Skip ¶ added in v1.3.1
func (s StructStream[T]) Skip(amount int) StructStream[T]
The Skip function discards the first n elements of a stream, where n is the passed parameter.
func (StructStream[T]) Slice ¶ added in v1.2.2
func (s StructStream[T]) Slice(start int, end int) StructStream[T]
The Slice function returns a copy of a portion of a stream into a new stream selected from start to end (end not included) where start and end represent the index of items in the stream.
func (StructStream[T]) Some ¶ added in v1.2.0
func (s StructStream[T]) Some(expression func(item T) bool) bool
The Some function determines whether any of the elements of the stream satisfy the passed condition.
func (StructStream[T]) Sum ¶ added in v1.2.0
func (s StructStream[T]) Sum(fieldName string) float64
The Sum function adds up all values in a stream. The first parameter is the name of the field you want to calculate by.
func (StructStream[T]) Wait ¶ added in v1.2.0
func (s StructStream[T]) Wait(duration time.Duration) StructStream[T]
The Wait function pauses the current stream for the duration passed. The first and only parameter expects a value from the built-in time.Duration package.