Documentation ¶
Index ¶
- func BoolToString(b bool) string
- func Equal[T any](a, b []T, cmp func(T, T) bool) bool
- func GenerateRandomBytes(n int) []byte
- func GetEnvOrDefault(key, defaultValue string) string
- func GetRandomInRange(min, max int) int
- func IntToString(i int) string
- func Max[T string | uint | uint32 | uint64 | int | int32 | int64 | float32 | float64](a, b T) T
- func SliceContains[T any](slice []T, v T, eq func(T, T) bool) bool
- func StringToBool(s string) bool
- func StringToInt(s string) int
- func ToPointer[T any](v T) *T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolToString ¶
BoolToString returns "true" if the given boolean is true, otherwise returns "false".
func GenerateRandomBytes ¶
GenerateRandomBytes generates a random byte slice of the given length.
func GetEnvOrDefault ¶
GetEnvOrDefault returns the value of the given environment variable if it exists, otherwise returns the given default value.
func GetRandomInRange ¶
GetRandomInRange takes a min and max value and returns a random value between the two.
func IntToString ¶
IntToString returns the string representation of the given integer.
func SliceContains ¶
SliceContains returns true if the slice holds the value given value
func StringToBool ¶
StringToBool returns true if the given string is "true", otherwise returns false.
func StringToInt ¶
StringToInt returns the integer representation of the given string.
If the string cannot be converted to an integer, this function panics.
Types ¶
This section is empty.