Documentation ¶
Index ¶
- func CheckVersion(versionString string, versionConstraint string) (bool, error)
- func ContextTimeout(ctx context.Context, def time.Duration) int
- func DiffSlices[T comparable](sliceA []T, sliceB []T) ([]T, []T)
- func HasAnyPrefix(value string, prefixes []string) bool
- func IsSocketWritable(socketPath string) bool
- func SortMapKeys[T any](m map[string]T) []string
- func ToPrettyJSON(v any) string
- func ValueInSlice[T comparable](value T, slice []T) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶
CheckVersion checks whether the version satisfies the provided version constraints.
func ContextTimeout ¶
ContextTimeout converts context deadline into timeout (time until it runs out). If the context has no deadline, the default timeout is returned.
func DiffSlices ¶
func DiffSlices[T comparable](sliceA []T, sliceB []T) ([]T, []T)
DiffSlice compares two slices and returns removed and added elements. Note: Does not find differences for duplicate elemnts.
func HasAnyPrefix ¶
HasAnyPrefix checks whether a value has any of the prefixes.
func IsSocketWritable ¶
IsSocketWritable returns true if user has write permissions for socket on the given path.
func SortMapKeys ¶
SortMapKeys returns map keys sorted alphabetically.
func ToPrettyJSON ¶
ToPrettyJSON converts the given value into JSON string. If value cannot be marshaled into JSON, an empty string is returned.
func ValueInSlice ¶
func ValueInSlice[T comparable](value T, slice []T) bool
ValueInSlice checks whether a value is present in the given slice.
Types ¶
This section is empty.