utils

package
v0.1.322 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

copied and modified from datadog/dd-trace-go/internal/env.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolEnv added in v0.1.292

func BoolEnv(key string, def bool) bool

BoolEnv returns the parsed boolean value of an environment variable, or def otherwise.

func CloneAndRedact added in v0.1.270

func CloneAndRedact(source interface{}) (dest interface{}, err error)

CloneAndRedact logs a redacted version of the object

func DurationEnv added in v0.1.292

func DurationEnv(key string, def time.Duration) time.Duration

DurationEnv returns the parsed duration value of an environment variable, or def otherwise.

func GenerateUniqueID added in v0.1.290

func GenerateUniqueID() string

func GenerateUnqueServiceName

func GenerateUnqueServiceName(prepend string) string

func IntEnv added in v0.1.292

func IntEnv(key string, def int) int

IntEnv returns the parsed int value of an environment variable, or def otherwise.

func IsEmptyOrNil added in v0.1.188

func IsEmptyOrNil(i interface{}) bool

IsEmptyOrNil checks if a value is empty or nil, useful for strings and arrays

func IsNil added in v0.1.188

func IsNil(i interface{}) bool

IsNil is a wholistic nil checker

func IsZero added in v0.1.188

func IsZero(v reflect.Value) bool

IsZero : determine is zero value 1. string => empty string 2. bool => false 3. function => nil 4. map => nil (uninitialized map) 5. slice => nil (uninitialized slice)

func MakeRedactedCopy added in v0.1.248

func MakeRedactedCopy(src, dst interface{}) error

MakeRedactedCopy ...

func PrettyJSON added in v0.1.220

func PrettyJSON(obj interface{}) string

PrettyJSON returns a pretty-printed JSON string for the given object.

func PrettyPrintRedacted added in v0.1.248

func PrettyPrintRedacted(source, dest interface{})

PrettyPrintRedacted ...

func Ptr added in v0.1.319

func Ptr[T any](value T) *T

Ptr returns a pointer to the given value.

func RandomString

func RandomString(n int) string

func Redact added in v0.1.248

func Redact(reflectValue reflect.Value)

Redact ...

Types

type Zeroer added in v0.1.188

type Zeroer interface {
	IsZero() bool
}

Zeroer :

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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