utils

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateStrings added in v2.5.0

func DeduplicateStrings(src []string) []string

DeduplicateStrings deduplicate string list, empty items are dropped.

func EqualSliceValues

func EqualSliceValues[E comparable](s1, s2 []E) bool

EqualSliceValues compare two slices if they have equal values independent of how they are sorted.

func MergeSlices

func MergeSlices[T any](slices ...[]T) []T

MergeSlices return a new slice that combines all values of input slices TODO: once https://github.com/golang/go/pull/61817 got merged, we should switch to it

func Paginate

func Paginate[T any](get func(page int) ([]T, error)) ([]T, error)

Paginate iterates over a func call until it does not return new items and return it as list.

func SliceToBoolMap

func SliceToBoolMap(s []string) map[string]bool

SliceToBoolMap is a helper function to convert a string slice to a map.

func StringSliceDeleteEmpty added in v2.4.0

func StringSliceDeleteEmpty(s []string) []string

StringSliceDeleteEmpty removes empty strings from a string slice.

func WithContextSigtermCallback

func WithContextSigtermCallback(ctx context.Context, f func()) context.Context

Returns a copy of parent context that is canceled when an os interrupt signal is received.

Types

This section is empty.

Jump to

Keyboard shortcuts

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