Documentation ¶
Index ¶
- func Coalesce[T comparable](arr ...T) T
- func Deref[T any](v *T) T
- func GetEnvOrDefault(names ...string) string
- func Interpolate(arg string, vars interface{}) string
- func InterpolateStrings(arg []string, vars interface{}) []string
- func NormalizeVersion(version string) string
- func Ptr[T any](value T) *T
- func RandomKey(length int) string
- func RandomString(length int) string
- func ShortTimestamp() string
- func Stringify(val any) (string, error)
- type NamedLock
- type Unlocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶ added in v1.11.0
func Coalesce[T comparable](arr ...T) T
Coalesce returns the first non-zero element
func GetEnvOrDefault ¶
GetEnvOrDefault returns the first non-empty environment variable
func Interpolate ¶
Interpolate templatises the string using the vars as the context
func InterpolateStrings ¶
InterpolateStrings templatises each string in the slice using the vars as the context
func NormalizeVersion ¶ added in v1.1.1
NormalizeVersion appends "v" to version string if it's not exist
func RandomString ¶
RandomString returns a random string consisting of the characters in randomChars, with the length customized by the parameter
func ShortTimestamp ¶
func ShortTimestamp() string
ShortTimestamp returns a shortened timestamp using week of year + day of week to represent a day of the e.g. 1st of Jan on a Tuesday is 13
Types ¶
Click to show internal directories.
Click to hide internal directories.