pipe

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk added in v1.0.3

func Chunk[T any](size int) func([]T) ([][]T, error)

func Contains

func Contains[T comparable](element T) func([]T) (bool, error)

Contains adapts the contains function for pipeline use.

func DistinctBy added in v1.0.3

func DistinctBy[T any, K comparable](key func(T) K) func([]T) ([]T, error)

func Filter

func Filter[T any](f func(T) bool) func([]T) ([]T, error)

Filter adapts the filter function for pipeline use.

func ForEach

func ForEach[T any](action func(T)) func([]T) ([]T, error)

ForEach adapts the forEach function for pipeline use. Nota: Embora ForEach não retorne um valor, para manter a assinatura consistente, retornaremos a própria slice e nil para o erro.

func GroupBy

func GroupBy[T any, K comparable](f func(T) K) func([]T) ([]T, error)

func GroupCountBy added in v1.0.3

func GroupCountBy[T any, K comparable](key func(T) K) func([]T) (map[K]int, error)

func GroupReduceBy added in v1.0.3

func GroupReduceBy[T any, K comparable, A any](key func(T) K, reduce func(A, T) A) func([]T) (map[K]A, error)

func GroupStatsBy added in v1.0.3

func GroupStatsBy[T any, K comparable, V Number](key func(T) K, value func(T) V) func([]T) (map[K]array.GroupStats[V], error)

func GroupSumBy added in v1.0.3

func GroupSumBy[T any, K comparable, V Number](key func(T) K, value func(T) V) func([]T) (map[K]V, error)

func GroupSumByWhere added in v1.0.3

func GroupSumByWhere[T any, K comparable, V Number](where func(T) bool, key func(T) K, value func(T) V) func([]T) (map[K]V, error)

func IndexBy added in v1.0.3

func IndexBy[T any, K comparable](key func(T) K) func([]T) (map[K]T, error)

func IndexOf

func IndexOf[T comparable](element T) func([]T) (int, error)

IndexOf adapts the indexOf function for pipeline use.

func Join

func Join[T any](sep string) func([]T) (string, error)

Join adapts the join function for pipeline use.

func Map

func Map[T any, U any](f func(T) U) func([]T) ([]U, error)

Map adapts the map function for pipeline use.

func Max

func Max[T Number]() func([]T) (T, error)

func Min

func Min[T Number]() func([]T) (T, error)

func Partition added in v1.0.3

func Partition[T any](f func(T) bool) func([]T) ([]T, []T, error)

func Pop

func Pop[T any]() func([]T) (T, []T, error)

Pop adapts the pop function for pipeline use.

func Product

func Product[T Number]() func([]T) (T, error)

Product adapts the product function for pipeline use.

func Push

func Push[T any](elements ...T) func([]T) ([]T, error)

Push adapts the push function for pipeline use.

func Reduce

func Reduce[T any](f func(T, T) T) func([]T) (T, error)

Reduce adapts the reduce function for pipeline use.

func Reverse

func Reverse[T any]() func([]T) ([]T, error)

Reverse adapts the reverse function for pipeline use.

func Shift

func Shift[T any]() func([]T) (T, []T, error)

Shift adapts the shift function for pipeline use.

func Shuffle

func Shuffle[T any]() func([]T) ([]T, error)

Shuffle adapts the shuffle function for pipeline use.

func Skip added in v1.0.3

func Skip[T any](n int) func([]T) ([]T, error)

func Sort

func Sort[T any](less func(i, j T) bool) func([]T) ([]T, error)

Sort adapts the sort function for pipeline use. Sort adapts the sort function for pipeline use, requiring a comparison function.

func SortBy added in v1.0.3

func SortBy[T any, K cmp.Ordered](key func(T) K) func([]T) ([]T, error)

func Sum

func Sum[T Number]() func([]T) (T, error)

Sum adapts the sum function for pipeline use.

func Take added in v1.0.3

func Take[T any](n int) func([]T) ([]T, error)

func Unique

func Unique[T comparable]() func([]T) ([]T, error)

Unique adapts the unique function for pipeline use.

func Unshift

func Unshift[T any](elements ...T) func([]T) ([]T, error)

Unshift adapts the unshift function for pipeline use.

Types

type Number

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
		~float32 | ~float64
}

Jump to

Keyboard shortcuts

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