pipies

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Function set to use with Sort

Function set to use with Filter

Function set to use with Reduce

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distinct added in v1.0.5

func Distinct[T any, C comparable](getKey func(x *T) C) pipe.Predicate[T]

Distinct returns a predicate with filters out the same elements compated by the output of getKey function. getKey function should receive an argument of a Pipe value type. The result function is rather slow since it takes a lock on each element. You should use Pipe.Distinct() to get better performance.

func Eq

func Eq[T comparable](x T) pipe.Predicate[T]

Eq returns a predicate which is true when the argument is equal to x.

func IsNil

func IsNil[T any](x *T) bool

IsNil returns true if x underlying value is nil.

func Less

func Less[T constraints.Ordered](x, y *T) bool

Less returns true if x < y, false otherwise.

func LessThan

func LessThan[T constraints.Ordered](x T) pipe.Predicate[T]

LessThan returns a predicate which is true when the argument is less than x.

func Not added in v1.0.2

func Not[T any](fn func(x T) bool) func(T) bool

Not returns a new function that negates the result of the input function.

func NotEq

func NotEq[T comparable](x T) pipe.Predicate[T]

NotEq returns a predicate which is true when the argument is NOT equal to x.

func NotNil

func NotNil[T any](x *T) bool

NotNil returns true is x underlying value is not nil. It uses reflection, so if you don't store any pointers, better use NotZero.

func NotZero

func NotZero[T comparable](x *T) bool

NotZero returns true is x equals to a default zero value of the type T.

func Nott added in v1.0.2

func Nott[T1, T2 any](fn func(x T1, y T2) bool) func(T1, T2) bool

Nott returns a new function that negates the result of the input function.

func Nottt added in v1.0.2

func Nottt[T1, T2, T3 any](fn func(x T1, y T2, z T3) bool) func(T1, T2, T3) bool

Nottt returns a new function that negates the result of the input function.

func Sum

func Sum[T cns.Float | cns.Integer | cns.Complex | ~string](a, b *T) T

Sum is a reduce function for summing up types that support "+".

Types

This section is empty.

Jump to

Keyboard shortcuts

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