operators

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any](ctx context.Context, elements []T, fn FilterFn[T]) (targets []T, err error)

func Find

func Find[T any](ctx context.Context, elements []T, fn FindFn[T]) (target T, found bool, err error)

func Foreach

func Foreach[T any](ctx context.Context, elements []T, fn ForeachFn[T]) (err error)

func Map

func Map[S any, D any](ctx context.Context, src S, fn MapFn[S, D]) (dst D, err error)

func MapSlice

func MapSlice[S any, D any](ctx context.Context, src []S, fn MapFn[S, D]) (dst []D, err error)

func Ternary

func Ternary(ctx context.Context, condition func(ctx context.Context) (ok bool), truthy TernaryFn, falsy TernaryFn) (returning bool, err error)

func TernaryFalsy

func TernaryFalsy(ctx context.Context, condition func(ctx context.Context) (ok bool), falsy TernaryFn) (returning bool, err error)

func TernaryTruthy

func TernaryTruthy(ctx context.Context, condition func(ctx context.Context) (ok bool), truthy TernaryFn) (returning bool, err error)

Types

type FilterFn

type FilterFn[T any] func(ctx context.Context, element T) (ok bool, err error)

type FindFn

type FindFn[T any] func(ctx context.Context, element T) (found bool, err error)

type ForeachFn

type ForeachFn[T any] func(ctx context.Context, i int, element T) (err error)

type MapFn

type MapFn[S any, D any] func(ctx context.Context, src S) (dst D, err error)

type TernaryFn

type TernaryFn func(ctx context.Context) (returning bool, err error)

Jump to

Keyboard shortcuts

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