util

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 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](slice []T, predicate func(T) bool) []T

func FirstMatch

func FirstMatch[T any](slice []T, predicate func(T) bool) (T, bool)

func GroupBy

func GroupBy[T any, K comparable](slice []T, keyFunc func(T) K) map[K][]T

func Keys

func Keys[T any, K comparable](m map[K]T) []K

func Map

func Map[T any, E any](slice []T, mapFunc func(T) E) []E

func Sample

func Sample[T any](slice []T, n int) []T

Sample randomly selects n elements from a slice. elements selected are unique by index

func ToSet

func ToSet[T comparable](s []T) map[T]bool

func UniqBy added in v0.1.7

func UniqBy[T any, K comparable](slice []T, keyFunc func(T) K) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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