utils

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 11 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(names ...string) string

GetEnvOrDefault returns the first non-empty environment variable

func Interpolate

func Interpolate(arg string, vars interface{}) string

Interpolate templatises the string using the vars as the context

func InterpolateStrings

func InterpolateStrings(arg []string, vars interface{}) []string

InterpolateStrings templatises each string in the slice using the vars as the context

func NormalizeVersion added in v1.1.1

func NormalizeVersion(version string) string

NormalizeVersion appends "v" to version string if it's not exist

func RandomKey

func RandomKey(length int) string

func RandomString

func RandomString(length int) string

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

func Stringify added in v1.6.4

func Stringify(val any) (string, error)

Stringify converts the given value to a string. If the value is already a string, it is returned as is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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