utils

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetElemOrDefaultFromMap

func GetElemOrDefaultFromMap[T int | uint64](m map[string]string, key string, def T) T

GetElemOrDefaultFromMap returns the value of a key from a map, or a default value if the key does not exist or the value is not of the expected type.

func GetIntValFromString

func GetIntValFromString(val string, defaultValue int) int

GetIntValFromString returns an int value if the string is not empty and is a correct integer OR default value.

func GetIntValOrDefault

func GetIntValOrDefault(val int, defaultValue int) int

GetIntValOrDefault returns an int value if greater than 0 OR default value.

func GetRandOrDefaultString

func GetRandOrDefaultString(defaultVal string) string

GetRandOrDefaultString is used when we need to generate a random string, but don't want to fail if the entropy pool is empty (e.g. in tests) One example usage is for validating the aws connection on dapr initialisation

func Unquote

func Unquote(data []byte) (res string)

Unquote parses a request data that may be quoted due to JSON encoding, and removes the quotes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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