Documentation
¶
Index ¶
- func Abs[N Number](n N) N
- func BoolToStr(b bool, ifTrue string, ifFalse string) string
- func Clone[T any](t *T) *T
- func DeepEqualWithUnionHandling(v1, v2 reflect.Value) bool
- func DefaultBoolIfNil(b *bool, defaultB bool) bool
- func DefaultIfError(fn StringerWithError, defaultS string) string
- func DefaultIfNil(s *string, defaultS string) string
- func DefaultIfNotInMap(m map[string]string, key string, def string) string
- func DefaultString(s string, defaultS string) string
- func EnsureMap[T comparable, U any](m map[T]U) map[T]U
- func GetFromMap[K comparable, V any](in map[K]V, key K) (V, bool)
- func GetHostname() string
- func GetOrgIdFromContext(ctx context.Context) (uuid.UUID, bool)
- func GetResourceOwner(owner *string) (string, string, error)
- func IsEmptyString(s *string) bool
- func IsFIPSEnabled() bool
- func LabelArrayToMap(labels []string) map[string]string
- func LabelMapToArray(labels *map[string]string) []string
- func LabelsMatchLabelSelector(labels map[string]string, labelSelector map[string]string) bool
- func Max[N Number](n1, n2 N) N
- func MergeLabels(labels ...map[string]string) map[string]string
- func Min[N Number](n1, n2 N) N
- func Must(err error)
- func MustString(fn StringerWithError) string
- func OwnerQueryParamsToArray(ownerQueryParam *string) []string
- func PercentageAsInt(p string) (int, error)
- func ResetFIPSCache()
- func ResourceOwner(kind string, name string) string
- func SetResourceOwner(kind string, name string) *string
- func SingleQuote(input []string) []string
- func SliceToPtrWithNilDefault(s []string) *[]string
- func StringsAreEqual(a, b *string) bool
- func StructToMap(obj interface{}) (map[string]interface{}, error)
- func TimeStampString() string
- func TimeStampStringPtr() *string
- func ToPtrWithNilDefault[T comparable](i T) *T
- func WithOrganizationID(ctx context.Context, orgID uuid.UUID) context.Context
- func WithUserAgent(ctx context.Context, userAgent string) context.Context
- type Duration
- type Number
- type Singleton
- type StringerWithError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqualWithUnionHandling ¶ added in v0.9.0
func DefaultBoolIfNil ¶
func DefaultIfError ¶
func DefaultIfError(fn StringerWithError, defaultS string) string
func DefaultIfNil ¶
func DefaultIfNotInMap ¶ added in v0.2.0
func DefaultString ¶
func EnsureMap ¶ added in v0.4.0
func EnsureMap[T comparable, U any](m map[T]U) map[T]U
EnsureMap takes a map as input and guarantees that it is not nil. If the input map is nil, it initializes and returns a new empty map of the same type. If the input map is already initialized, it simply returns the map unchanged.
func GetFromMap ¶ added in v0.4.0
func GetFromMap[K comparable, V any](in map[K]V, key K) (V, bool)
func GetHostname ¶ added in v0.10.0
func GetHostname() string
GetHostname returns the system hostname, or "unknown" if it cannot be determined
func GetOrgIdFromContext ¶ added in v0.9.0
func IsEmptyString ¶
func IsFIPSEnabled ¶
func IsFIPSEnabled() bool
IsFIPSEnabled detects if the system is running in FIPS mode using multiple detection methods. The result is cached after the first check for performance.
Detection methods (in order of precedence):
- Go 1.24's crypto/fips140.Enabled() - Runtime FIPS mode detection
- /proc/sys/crypto/fips_enabled - Linux kernel FIPS mode indicator
- OPENSSL_FORCE_FIPS_MODE environment variable - OpenSSL forced FIPS mode
- GOLANG_FIPS environment variable - Go FIPS mode indicator
func LabelArrayToMap ¶
func LabelMapToArray ¶
func MustString ¶
func MustString(fn StringerWithError) string
func OwnerQueryParamsToArray ¶
func PercentageAsInt ¶
PercentageAsInt parses a percentage string (e.g., "50%") to an integer. It validates that the string is in the correct format and the value is between 0 and 100 inclusive.
func ResetFIPSCache ¶
func ResetFIPSCache()
ResetFIPSCache clears the cached FIPS detection result. This is primarily useful for testing and should not be called in production code.
func ResourceOwner ¶ added in v0.4.0
func SetResourceOwner ¶
func SingleQuote ¶
func StringsAreEqual ¶ added in v0.7.0
func StructToMap ¶ added in v0.6.0
func TimeStampString ¶ added in v0.4.0
func TimeStampString() string
func TimeStampStringPtr ¶
func TimeStampStringPtr() *string
func ToPtrWithNilDefault ¶ added in v0.4.0
func ToPtrWithNilDefault[T comparable](i T) *T
func WithOrganizationID ¶ added in v0.9.0
Types ¶
type Number ¶ added in v0.4.0
type Number interface {
constraints.Integer | constraints.Float
}
type Singleton ¶ added in v0.6.0
type Singleton[T any] struct { // contains filtered or unexported fields }