Documentation ¶
Index ¶
- Constants
- func DefaultIfEmpty(v string, d string) string
- func DefaultIfNil[V any](val, def *V) *V
- func Dehumanize(humanizedNumber string) (int64, error)
- func Hash[T any](s T) ([]byte, error)
- func HashString[T any](s T) (string, error)
- func Humanize(number int64) string
- func PanicOnError(err error)
- func PanicOnErrorFunc(f func() error)
- func ToPointer[V any](v V) *V
Constants ¶
View Source
const ( Ki = 1024 Mi = 1024 * Ki Gi = 1024 * Mi Ti = 1024 * Gi Pi = 1024 * Ti )
Variables ¶
This section is empty.
Functions ¶
func DefaultIfEmpty ¶ added in v0.0.3
DefaultIfEmpty returns v if not empty otherwise d
func DefaultIfNil ¶
func DefaultIfNil[V any](val, def *V) *V
DefaultIfNil returns val if val is not nil, def otherwise
func Dehumanize ¶ added in v0.0.3
Dehumanize parses a string representation of a number in power of two and returns as number, e.g. 1, 5Mi, 10Gi.
func HashString ¶ added in v0.0.3
Hash returns a SHA256 hash of the given struct as string
func Humanize ¶ added in v0.0.3
Humanize returns a string representation of the given number in power of two.
func PanicOnError ¶
func PanicOnError(err error)
PanicOnError panics if the given error is not nil DO NOT USE WITH DEFER
func PanicOnErrorFunc ¶
func PanicOnErrorFunc(f func() error)
PanicOnErrorFunc panics if the given function execution error is not nil
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.