helper

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 20 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound error = errors.Sentinel("Key not found in map")

Functions

func DeleteItemFromSlice added in v0.1.3

func DeleteItemFromSlice(x any, index int) any

DeleteItemFromSlice is a generic function to remove item from a slice

func Diff added in v0.1.3

func Diff(expected, current any) string

Diff is cmp.Diff with custom function to compare slices with pretty.Sprint

func DiffMapString added in v0.1.3

func DiffMapString(expected, current map[string]string, excludeKeys []string) string

DiffMapString permit to diff map[string]string

func Get

func Get(m map[string]any, key string) (value any, err error)

Get permit to get value on from from key It return error if key not exist

func GetKubeClientTimeoutFromEnv added in v0.1.3

func GetKubeClientTimeoutFromEnv() (timeout time.Duration, err error)

func GetLogrusFormatterFromEnv added in v0.1.3

func GetLogrusFormatterFromEnv() logrus.Formatter

func GetLogrusLogLevelFromEnv added in v0.1.3

func GetLogrusLogLevelFromEnv() logrus.Level

func GetWatchNamespaceFromEnv added in v0.1.3

func GetWatchNamespaceFromEnv() (ns string, err error)

func GetZapFormatterFromDev added in v0.1.3

func GetZapFormatterFromDev() zapcore.Encoder

func GetZapLogLevelFromEnv added in v0.1.3

func GetZapLogLevelFromEnv() zapcore.Level

func Merge added in v0.1.3

func Merge(dst any, srcs ...any) (err error)

Merge permit to merge unlimited same interface. The last src is the higher priority If some src are nil, it skip it It return error if dst is nil

func PrintVersion added in v0.1.3

func PrintVersion(logger logr.Logger, metricsAddr, probeAddr string)

func RandomString added in v0.1.3

func RandomString(length int) string

RandomString generates a random string from a subset of characters

func StringToSlice added in v0.1.3

func StringToSlice(value, separator string) (result []string)

StringToSlice permit to convert string with separator to slice Is like strings.Split with trimSpaces each items

func ToSliceOfObject added in v0.1.3

func ToSliceOfObject(s any) []client.Object

ToSliceOfObject permit to convert any slice of object to slice of client.Object Slice must not contain pointer

func UnZipBase64Decode added in v0.1.3

func UnZipBase64Decode(original string, originalObject any) error

func ZipAndBase64Encode added in v0.1.3

func ZipAndBase64Encode(originalObject any) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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