filters

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOrUpdateSlice

func AddOrUpdateSlice[T any](slice []T, items ...T) []T

AddOrUpdateSlice add or update slice

func Filter

func Filter[T any](objs []T, filter func(obj T) bool) []T

Filter filter one slice

func FilterMap

func FilterMap[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V

FilterMap filter one map to another map

func First

func First[T any](objs []T) (T, bool)

First make return first for slice

func GetDefault

func GetDefault[T any](s, d T) T

GetDefault godoc

func IsZero

func IsZero[T any](v T) bool

IsZero true when arg is zero

func IteratePartitions

func IteratePartitions[T comparable](devices []T, size int, callback func([][]T))

func IterateSets

func IterateSets[T any](devices []T, size int, callback func([]T))

func Map

func Map[T any, K any](objs []T, mapper func(obj T) ([]K, bool)) []K

Map one slice

func Max

func Max[T cmp.Ordered](ts ...T) T

func Min

func Min[T cmp.Ordered](ts ...T) T

func NoSpace

func NoSpace(s string) bool

NoSpace is filter func for strings

func OR

func OR[T any](vs ...T) T

OR return values which not zero value

func Range

func Range[T any](objs []T, fn func(obj T) bool)

Range run func in slice

func SetContains

func SetContains[T comparable](set []T, d T) bool

func SetCopyAndAddPadding

func SetCopyAndAddPadding[T comparable](set []T, size int) []T

func SetCountPadding

func SetCountPadding[T comparable](set []T) int

func Sum

func Sum[T cmp.Ordered](ts ...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