Documentation ¶
Index ¶
- func GetEnv(envVar string, deflt string) string
- func GetEnvAs[T any](envVar string, deflt T, parser EnvParserFunc[T]) T
- func InterfaceToStringArray(source interface{}) ([]string, error)
- func LogDebugIfContextCancelled(ctx context.Context, cleanupErr error, msg string)
- func NewDetachedContext(parent context.Context) context.Context
- type Compare
- type EnvParserFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvAs ¶ added in v1.0.1
func GetEnvAs[T any](envVar string, deflt T, parser EnvParserFunc[T]) T
func InterfaceToStringArray ¶ added in v1.2.1
InterfaceToStringArray converts an interface{} that we know is a []string to that []string via []interface{}. This is useful when we have a map[string]interface{} and we want to get the []string{} out of it.
func LogDebugIfContextCancelled ¶ added in v0.3.26
LogDebugIfContextCanceled will ensure that LOG_LEVEL is set to debug if the context is canceled.
func NewDetachedContext ¶
NewDetachedContext produces a new context that has a separate cancellation mechanism from its parent. This should be used when having to continue using a context after it has been canceled, such as cleaning up Docker resources after the context has been canceled but want to keep work associated with the same trace.
Types ¶
type Compare ¶ added in v1.2.2
type Compare[T constraints.Ordered] struct{}
Compare exists as a temporary measure to provide a simple cmp() implementation for any ordered types. This was implemented to enable us to handle the exp/slices update to SortFunc() which switched from expecting a less() function to a cmp() function.
Once we upgrade to Go 1.21 we can remove this and use the builtin cmp package - see https://pkg.go.dev/cmp