utils

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateStrings

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 IsValidKeepMinValue

func IsValidKeepMinValue(value int64) (bool, error)

used to check if project settings value for keepMin is valid.

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), limit int) ([]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

func StringSliceDeleteEmpty(s []string) []string

StringSliceDeleteEmpty removes empty strings from a string slice.

func ValidateDuration

func ValidateDuration(durationStr string) error

used to check if project settings value for keepDuration is valid.

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