Documentation ¶
Overview ¶
Package util offers misc utility functions
Index ¶
- Constants
- func Coalesce(obj ...interface{}) (r interface{})
- func GetRandomAlphanumericString(n int) string
- func NormalizeDurationStringHMS(d time.Duration) string
- func NormalizeDurationStringYMDHMS(year, month, day, hour, min, sec int) string
- func OpenWebsiteInDefaultBrowser(url string) bool
- func RemoveFromStringSlice(slice []string, el string) []string
- func RemoveIndexFromStringSlice(slice []string, i int) []string
- func SaveCopy(src, dst string) error
- func TimeDifferenceYMDHMS(a, b time.Time) (year, month, day, hour, min, sec int)
- func WaitForEnter()
Constants ¶
const AppName string = "goBlue/util"
AppName is the name of the application
const FullVersion string = AppName + VersionMajor + "." + VersionMinor + VersionBuild
FullVersion contains the full name and version of this package in a printable string
const VersionBuild string = "s"
VersionBuild is the type of this release. s(table), b(eta), d(evelopment), n(ightly)
const VersionMajor string = "0"
VersionMajor 0 means in development, >1 ensures compatibility with each minor version, but breakes with new major version
const VersionMinor string = "1"
VersionMinor introduces changes that require a new version number. If the major version is 0, they are likely to break compatibility
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce(obj ...interface{}) (r interface{})
Coalesce returns first non-empty object of slice
func GetRandomAlphanumericString ¶
GetRandomAlphanumericString returns a random alphanumeric string of length n
func NormalizeDurationStringHMS ¶
NormalizeDurationStringHMS formats a time d into a string containing "x hours x minutes x seconds" while it removes 0 valued parts
func NormalizeDurationStringYMDHMS ¶
NormalizeDurationStringYMDHMS formats the output of TimeDifferenceYMDHMS into a string
func OpenWebsiteInDefaultBrowser ¶
OpenWebsiteInDefaultBrowser uses the system api to open a website in the default browser
func RemoveFromStringSlice ¶
RemoveFromStringSlice removes the first matching string from a slice
func RemoveIndexFromStringSlice ¶
RemoveIndexFromStringSlice removes a string on index i from a slice
func TimeDifferenceYMDHMS ¶
TimeDifferenceYMDHMS calculates the difference between times a and b and outputs a the difference as integers
Types ¶
This section is empty.