asyncaggregate

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsMap

func AsMap[In any, K comparable, V any](prevStage stages.Stage[In], mapFunc functions.MapFunc[In, types.Tuple[K, V]], confs ...configs.StageConfig) *types.Future[map[K]V]

AsMap is an async aggregation function that reduces all the elements from the stage channel to a map. This function returns a types.Future that will be completed with the map of all the elements from the stage channel. Check types.Future for more details.

The key of the map is the first element of the tuple returned by the given function, and the value is the second element of the tuple returned by the given function.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to reduce the elements to a slice, use AsSlice instead. If you need to reduce the elements to a sorted slice, use Sort or SortDesc instead. If you need to reduce the elements to a multimap, use AsMultiMap instead. If you need to reduce the elements to a single value, use Sum, Avg, Max, Min, Count or Reduce instead. If you need the sync version of this function, use the aggregate.AsMap instead.

func AsMultiMap

func AsMultiMap[In any, K comparable, V any](prevStage stages.Stage[In], mapFunc functions.MapFunc[In, types.Tuple[K, V]], confs ...configs.StageConfig) *types.Future[map[K][]V]

AsMultiMap is an async aggregation function that reduces all the elements from the stage channel to a multimap. This function returns a types.Future that will be completed with the multimap of all the elements from the stage channel. Check types.Future for more details.

The key of the map is the first element of the tuple returned by the given function, and the value is the slice of all the second elements of the tuples returned by the given function that have the same first element.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to reduce the elements to a slice, use AsSlice instead. If you need to reduce the elements to a sorted slice, use Sort or SortDesc instead. If you need to reduce the elements to a map, use AsMap instead. If you need to reduce the elements to a single value, use Sum, Avg, Max, Min, Count or Reduce instead. If you need the sync version of this function, use the aggregate.AsMultiMap instead.

func AsSlice

func AsSlice[In any](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[[]In]

AsSlice is an async aggregation function that reduces all the elements from the stage channel to a slice. This function returns a types.Future that will be completed with the slice of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to reduce the elements to a sorted slice, use Sort or SortDesc instead. If you need to reduce the elements to a map, use AsMap instead. If you need to reduce the elements to a multimap, use AsMultiMap instead. If you need to reduce the elements to a single value, use Sum, Avg, Max, Min, Count or Reduce instead. If you need the sync version of this function, use the aggregate.AsSlice instead.

func Avg

func Avg[In types.Number](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[float64]

Avg is an async aggregation function that calculates the average of all the elements from the stage channel. This function returns a types.Future that will be completed with the average of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to calculate the average of complex numbers, use AvgComplexType instead. If you need the sync version of this function, use the aggregate.Avg instead.

func AvgComplexType

func AvgComplexType[In types.ComplexNumber](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[complex128]

AvgComplexType is an async aggregation function that calculates the average of all the elements from the stage channel. This function returns a types.Future that will be completed with the average of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to calculate the average of simple numbers, use Avg instead. If you need the sync version of this function, use the aggregate.AvgComplexType instead.

func Count

func Count[In any](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[int64]

Count is an async aggregation function that counts all the elements from the stage channel. This function returns a types.Future that will be completed with the number of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need the sync version of this function, use the aggregate.Count instead.

func Distinct

func Distinct[In comparable](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[[]In]

Distinct is an async aggregation function that removes all the duplicate elements from the stage channel. The result is in a random order. This function returns a types.Future that will be completed with the slice of all the distinct elements from the stage channel. Check types.Future for more details.

This function is useful when you need to remove all the duplicate elements from the stage channel.

Only the comparable types are supported.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need the sync version of this function, use the aggregate.Distinct instead.

func DistinctCount

func DistinctCount[In comparable](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[int64]

DistinctCount is an async aggregation function that counts all the distinct elements from the stage channel. This function returns a types.Future that will be completed with the number of all the distinct elements from the stage channel. Check types.Future for more details.

This function is useful when you need to count all the distinct elements from the stage channel.

Only the comparable types are supported.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to get the distinct elements, use Distinct instead. If you need the sync version of this function, use the aggregate.DistinctCount instead.

func ForEach

func ForEach[In any](prevStage stages.Stage[In], forEachFunc functions.ForEachFunc[In], confs ...configs.StageConfig) *types.Future[types.Void]

ForEach is an async aggregation function that iterates over all the elements from the stage channel. This function returns a types.Future that will be completed with the void value. Check types.Future for more details.

This function is useful when you need to iterate over all the elements from the stage channel, but you don't need to return any value.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to return a value, use Reduce instead. If you need the sync version of this function, use the aggregate.ForEach instead.

func GroupBy

func GroupBy[In any, K comparable](prevStage stages.Stage[In], groupByFunc functions.MapFunc[In, K], confs ...configs.StageConfig) *types.Future[map[K][]In]

GroupBy is an async aggregation function that groups all the elements from the stage channel by the given function. This function returns a types.Future that will be completed with the map of all the elements from the stage channel grouped by the given function. Check types.Future for more details.

The key of the map is the result of the given function, and the value is the slice of all the elements from the stage channel that have the same result of the given function.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need the sync version of this function, use the aggregate.GroupBy instead.

func Max

func Max[In types.Number](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[In]

Max is an async aggregation function that calculates the maximum of all the elements from the stage channel. This function returns a types.Future that will be completed with the maximum of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

It is not possible to use this function with complex numbers, as Go offers no way to compare them. If you need the sync version of this function, use the aggregate.Max instead.

func Min

func Min[In types.Number](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[In]

Min is an async aggregation function that calculates the minimum of all the elements from the stage channel. This function returns a types.Future that will be completed with the minimum of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

It is not possible to use this function with complex numbers, as Go offers no way to compare them. If you need the sync version of this function, use the aggregate.Min instead.

func Reduce

func Reduce[In any](prevStage stages.Stage[In], reduceFunc functions.ReduceFunc[In], confs ...configs.StageConfig) *types.Future[In]

Reduce is an async aggregation function that reduces all the elements from the stage channel by the given function. This function returns a types.Future that will be completed with the result of reducing all the elements from the stage channel by the given function. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to reduce the elements to a slice, use AsSlice instead. If you need to reduce the elements to a sorted slice, use Sort or SortDesc instead. If you need to reduce the elements to a map, use AsMap instead. If you need to reduce the elements to a multimap, use AsMultiMap instead. If you need to reduce the elements to a single value, use Sum, Avg, Max, Min or Count instead. If you need the sync version of this function, use the aggregate.Reduce instead.

func Sort

func Sort[In cmp.Ordered](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[[]In]

Sort is an async aggregation function that sorts all the elements from the stage channel in the ascending order. This function returns a types.Future that will be completed with the sorted slice of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to sort the elements in the descending order, use SortDesc instead. If you need the sync version of this function, use the aggregate.Sort instead.

func SortDesc

func SortDesc[In cmp.Ordered](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[[]In]

SortDesc is an async aggregation function that sorts all the elements from the stage channel in the descending order. This function returns a types.Future that will be completed with the sorted slice of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to sort the elements in the ascending order, use Sort instead. If you need the sync version of this function, use the aggregate.SortDesc instead.

func Sum

func Sum[In types.Number](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[In]

Sum is an async aggregation function that sums all the elements from the stage channel. This function returns a types.Future that will be completed with the sum of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to sum complex numbers, use SumComplexType instead. If you need to sum numbers of a custom type, use Reduce instead. If you need the sync version of this function, use the aggregate.Sum instead.

func SumComplexType

func SumComplexType[In types.ComplexNumber](prevStage stages.Stage[In], confs ...configs.StageConfig) *types.Future[In]

SumComplexType is an async aggregation function that sums all the elements from the stage channel. This function returns a types.Future that will be completed with the sum of all the elements from the stage channel. Check types.Future for more details.

This is a final stage function, which means that it leads to the end of the pipeline. If you need to set up the pipeline, use functions from the [pipeline] package. If you need to make more transformations, use functions from the [transform] package instead.

If you need to sum simple numbers, use Sum instead. If you need to sum numbers of a custom type, use Reduce instead. If you need the sync version of this function, use the aggregate.SumComplexType instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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