oputil

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(haystack []string, key string) bool

Contains check if the haystack contains the key

func ContainsWithPrefix added in v0.1.9

func ContainsWithPrefix(haystack []string, prefix string) bool

ContainsWithPrefix check if the haystack contains a string with the prefix

func CreateConfigFromYamlString

func CreateConfigFromYamlString(extras string, name string, keyValues map[string]string, exclusions ...string) (string, map[string]string)

CreateConfigFromYamlString create a config string from a key-value map updated with the yaml extras excluding exclusions

func Float64Or

func Float64Or(envVar string, def float64) float64

Float64Or get the envVar as float64 otherwise the default

func Int32Or

func Int32Or(envVar string, def int32) int32

Int32Or get the envVar as int32 otherwise the default

func Int64Or

func Int64Or(envVar string, def int64) int64

Int64Or get the envVar as int64 otherwise the default

func IsOrdinalObjectIdle added in v0.10.4

func IsOrdinalObjectIdle(ordinalObjName string, replicas int) bool

IsOrdinalObjectIdle checks whether the ordinal object is idle. E.g for PVC, it means it's not longer attached to any pod.

func RandomBytes

func RandomBytes(len int) ([]byte, error)

RandomBytes generates a random bytes of len len or error

func RandomString

func RandomString(len int) (string, error)

RandomString generates a random base64 string of length len or err

func Remove

func Remove(key string, haystack []string) []string

Remove returns a slice of haystack with the key removed if present otherwise returns the haystack itself

func RequireFloat64

func RequireFloat64(envVar string) float64

RequireFloat64 returns the env variable as int64 or panic

func RequireValue

func RequireValue(envVar string) string

RequireValue returns the env Value or panic if none exists

func Value

func Value(envVar string) string

Value returns the environment value with white space trimmed

func ValueOr

func ValueOr(envVar, def string) string

ValueOr returns the value of Value or default if none exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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