utils

package
v2.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DedupStrings

func DedupStrings(src []string) []string

DedupStrings 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 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