helpers

package
v1.1.22 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPointerToStr

func BoolPointerToStr(b *bool) string

boolPointertoStr receives a bool pointer and returns a string. An empty string is returned if the pointer is nil.

func BoolToStr

func BoolToStr(b bool) string

boolToStr receives a boolean and returns a string

func ContextDelay

func ContextDelay(ctx context.Context, d time.Duration) error

func CopyBooleanValue

func CopyBooleanValue(target, source map[string]interface{}, targetKey, sourceKey string)

func CopyIntegerValue

func CopyIntegerValue(target, source map[string]interface{}, targetKey, sourceKey string)

func CopyIntegersList

func CopyIntegersList(target, source map[string]interface{}, targetKey, sourceKey string)

func CopyList

func CopyList(target, source map[string]interface{}, targetKey, sourceKey string)

func CopyMap

func CopyMap(source map[string]interface{}) map[string]interface{}

func CopyMapDeep

func CopyMapDeep(source map[string]interface{}) map[string]interface{}

func CopySensitiveListValue

func CopySensitiveListValue(localConfig *map[string]interface{}, targetConfig, upstreamConfig map[string]interface{}, targetKey, sourceKey string)

func CopySensitiveStringValue

func CopySensitiveStringValue(localConfig *map[string]interface{}, targetConfig, upstreamConfig map[string]interface{}, localKey, upstreamKey string)

func CopyStringValue

func CopyStringValue(target, source map[string]interface{}, targetKey, sourceKey string)

func FilterList

func FilterList(list []interface{}, filter func(elem interface{}) bool) *interface{}

func FilterMap

func FilterMap(
	source map[string]interface{},
	filter func(interface{}) bool,
	accept func(interface{}) interface{}) map[string]interface{}

func GetBoolOk added in v1.1.18

func GetBoolOk(v interface{}) (bool, bool)

func IntPointerToStr

func IntPointerToStr(i *int) string

intPointerToStr receives an int pointer and returns a string. An empty string is returned if the pointer is nil.

func IntToStr

func IntToStr(i int) string

intToStr receives an int and returns a string.

func Intersection

func Intersection[T comparable](a, b []T) (uniqueA, intersection, uniqueB []T)

intersection accepts two slices of same type as arguments and returns three slices: uniques for the first argument, intersection and uniques for second argument results are collections of distinct elements (sets)

func MapAddStr

func MapAddStr(msi map[string]interface{}, k, v string)

mapAddStr adds a non-empty string to a map[string]interface{}

func MapAddXInterface

func MapAddXInterface(msi map[string]interface{}, k string, v []interface{})

mapAddXInterface adds a non-empty []interface{} to a map[string]interface{}

func MapAddXString

func MapAddXString(msi map[string]interface{}, k string, v []string)

mapAddXInterface adds a non-empty []interface{} to a map[string]interface{}

func NewDiag

func NewDiag(severity diag.Severity, summary, detail string) diag.Diagnostic

newDiag receives a diag.Severity, a summary, a detail, and returns a diag.Diagnostic

func NewDiagAppend

func NewDiagAppend(diags diag.Diagnostics, severity diag.Severity, summary, detail string) diag.Diagnostics

newAppendDiag receives diag.Diagnostics, a diag.Severity, a summary, and a detail. It makes a new diag.Diagnostic, appends it to the diag.Diagnostics and returns the diag.Diagnostics.

func SetContextTimeout

func SetContextTimeout(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

func StrToBool

func StrToBool(s string) bool

strToBool receives a string and returns a boolean

func StrToInt

func StrToInt(s string) int

strToInt receives a string and returns an int. A zero is returned if an error is found while converting the string to int.

func StringInt32Hash

func StringInt32Hash(s string) int

func TryReadListValue

func TryReadListValue(source map[string]interface{}, key string) []interface{}

func TryReadValue

func TryReadValue(source map[string]interface{}, key string) interface{}

func ValidateStringBooleanValue

func ValidateStringBooleanValue(val any, key string) (warns []string, errs []error)

func XInterfaceStrXIneger

func XInterfaceStrXIneger(xi []interface{}) []int

xInterfaceStrXStr receives a []interface{} of type string and returns a []string

func XInterfaceStrXStr

func XInterfaceStrXStr(xi []interface{}) []string

xInterfaceStrXStr receives a []interface{} of type string and returns a []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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