Documentation
¶
Index ¶
- Constants
- func Base64StringToObject(encodedObject string, destination any) error
- func Int32ToUint64(v int32) (uint64, error)
- func Int64ToInt(v int64) (int, error)
- func Int64ToInt32(v int64) (int32, error)
- func Int64ToUint64(v int64) (uint64, error)
- func IntToByte(v int) (byte, error)
- func IntToInt32(v int) (int32, error)
- func IntToUint64(v int) (uint64, error)
- func ObjectToBase64String(object any) (string, error)
- func PtrToString[T any](v *T) string
- func RedactSecretsFromString(stringToSanitize string, replacements map[string]string, useRegex bool) string
- func ToBool(b string) bool
- func ToFormattedBool(value string) (string, error)
- func ToInt64(s string) (int64, error)
- func ToPositiveInt(s string) (int, error)
- func ToPositiveInt32(s string) (int32, error)
- func ToPositiveInt64(s string) (int64, error)
- func ToPrintableBoolPtr(bPtr *bool) string
- func ToPtr[T any](v T) *T
- func ToSlicePtrs[T any](slice []T) []*T
- func ToStringRedacted(structPointer interface{}, redactList []string, configVal interface{}) (out string)
- func ToTitle(str string) string
- func ToUint64(s string) (uint64, error)
- func ToVal[T any](v *T) T
- func TruncateString(s string, maxLength int) string
- func Uint64ToInt(v uint64) (int, error)
- func Uint64ToInt32(v uint64) (int32, error)
- func Uint64ToInt64(v uint64) (int64, error)
Constants ¶
const TimestampFormat = "2006-01-02T15:04:05Z"
TimestampFormat is a date time pattern used to convert times reported from various sources into a consistent date time formats.
Variables ¶
This section is empty.
Functions ¶
func Base64StringToObject ¶
func Int32ToUint64 ¶
Int32ToUint64 converts non-negative v to uint64.
func Int64ToInt ¶
Int64ToInt converts v to int after verifying it fits.
func Int64ToInt32 ¶
Int64ToInt32 converts v to int32 after verifying it fits.
func Int64ToUint64 ¶
Int64ToUint64 converts non-negative v to uint64.
func IntToInt32 ¶
IntToInt32 converts v to int32 after verifying it fits.
func IntToUint64 ¶
IntToUint64 converts non-negative v to uint64.
func ObjectToBase64String ¶
func PtrToString ¶
PtrToString converts any value into its string representation, or nil
func RedactSecretsFromString ¶
func ToBool ¶
ToBool wraps strconv.ParseBool to suppress errors. Returns false if strconv.ParseBool would return an error.
func ToFormattedBool ¶
ToFormattedBool returns lowercase string value for a valid boolean value, else returns same value with error.
func ToPositiveInt ¶
ToPositiveInt parses s into a platform-dependent int and returns an error if it is negative or out of range.
func ToPositiveInt32 ¶
ToPositiveInt32 parses s into an int32 and returns an error if it is negative or out of range.
func ToPositiveInt64 ¶
ToPositiveInt64 parses s into an int64 and returns an error if it is negative.
func ToPrintableBoolPtr ¶
func ToSlicePtrs ¶
func ToSlicePtrs[T any](slice []T) []*T
ToSlicePtrs converts a slice into a slice of pointers
func ToStringRedacted ¶
func ToStringRedacted(structPointer interface{}, redactList []string, configVal interface{}) (out string)
ToStringRedacted identifies attributes of a struct, stringifies them such that they can be consumed by the struct stringer interface, and redacts elements specified in the redactList.
func ToVal ¶
func ToVal[T any](v *T) T
ToVal converts any pointer to a value, into the value. If the supplied pointer is nil, the zero value of the type is returned.
func TruncateString ¶
TruncateString returns the specified string, shortened by dropping characters on the right side to the given limit.
func Uint64ToInt ¶
Uint64ToInt converts v to int after verifying it fits.
func Uint64ToInt32 ¶
Uint64ToInt32 converts v to int32 after verifying it fits.
func Uint64ToInt64 ¶
Uint64ToInt64 converts v to int64 after verifying it fits.
Types ¶
This section is empty.