operators

package
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 2 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, array []T, fn func(context.Context, T) (bool, error)) (r []T, err error)

func Find

func Find[T any](ctx context.Context, array []T, fn func(context.Context, T) (bool, error)) (r T, found bool, err error)

func Foreach

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

func Map

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

func MapOne

func MapOne[S any, R any](ctx context.Context, src S, fn func(context.Context, S) (R, error)) (dst R, err error)

func Sort

func Sort[T any](ctx context.Context, array []T, less func(context.Context, T, T) (bool, error)) (rr []T, err error)

func Ternary

func Ternary(ctx context.Context, condition func(ctx context.Context) (ok bool), truthy func(ctx context.Context), falsy func(ctx context.Context))

Types

This section is empty.

Jump to

Keyboard shortcuts

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