util

package
v0.0.0-...-6216d25 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 12 Imported by: 3

Documentation

Overview

Package util offers misc utility functions

Index

Constants

View Source
const AppName string = "goBlue/util"

AppName is the name of the application

FullVersion contains the full name and version of this package in a printable string

View Source
const VersionBuild string = "s"

VersionBuild is the type of this release. s(table), b(eta), d(evelopment), n(ightly)

View Source
const VersionMajor string = "0"

VersionMajor 0 means in development, >1 ensures compatibility with each minor version, but breakes with new major version

View Source
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

func GetRandomAlphanumericString(n int) string

GetRandomAlphanumericString returns a random alphanumeric string of length n

func NormalizeDurationStringHMS

func NormalizeDurationStringHMS(d time.Duration) string

NormalizeDurationStringHMS formats a time d into a string containing "x hours x minutes x seconds" while it removes 0 valued parts

func NormalizeDurationStringYMDHMS

func NormalizeDurationStringYMDHMS(year, month, day, hour, min, sec int) string

NormalizeDurationStringYMDHMS formats the output of TimeDifferenceYMDHMS into a string

func OpenWebsiteInDefaultBrowser

func OpenWebsiteInDefaultBrowser(url string) bool

OpenWebsiteInDefaultBrowser uses the system api to open a website in the default browser

func RemoveFromStringSlice

func RemoveFromStringSlice(slice []string, el string) []string

RemoveFromStringSlice removes the first matching string from a slice

func RemoveIndexFromStringSlice

func RemoveIndexFromStringSlice(slice []string, i int) []string

RemoveIndexFromStringSlice removes a string on index i from a slice

func SaveCopy

func SaveCopy(src, dst string) error

SaveCopy savely copies a file from src to dst

func TimeDifferenceYMDHMS

func TimeDifferenceYMDHMS(a, b time.Time) (year, month, day, hour, min, sec int)

TimeDifferenceYMDHMS calculates the difference between times a and b and outputs a the difference as integers

func WaitForEnter

func WaitForEnter()

WaitForEnter for userinput to continue

Types

This section is empty.

Jump to

Keyboard shortcuts

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