collection

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: BSD-2-Clause Imports: 5 Imported by: 6

README

Collection

This repo contains collection helpers.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = stderrors.New("not found")

Functions

func ChannelFnList

func ChannelFnList[T interface{}](
	ctx context.Context,
	fn func(ctx context.Context, ch chan<- T) error,
) ([]T, error)

func ChannelFnMap

func ChannelFnMap[T interface{}](
	ctx context.Context,
	getFn func(ctx context.Context, ch chan<- T) error,
	mapFn func(ctx context.Context, t T) error,
) error

func Contains

func Contains[T comparable](list []T, value T) bool

func Exclude

func Exclude[T comparable](list []T, excludes ...T) []T

func Filter

func Filter[T any](list []T, match func(value T) bool) []T

func Find

func Find[T any](list []T, match func(value T) bool) (*T, error)

func Ptr

func Ptr[T any](value T) *T

func Reverse

func Reverse[T any](values []T) []T

func UnPtr

func UnPtr[T any](ptr *T) T

func Unique

func Unique[T comparable](list []T) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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