utils

package
v0.0.0-...-84646e9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAndLog

func CloseAndLog(level logrus.Level, close func() error)

func CloseFileAndLogError

func CloseFileAndLogError(f *os.File)

CloseFileAndLogError closes a file and logs any errors

func ContainsString

func ContainsString(sa []string, os string) bool

ContainsString returns true if `os` is in the array `sa` and false if it is not.

func CountUniq

func CountUniq[S []E, E any, F comparable](arr S, f func(E) F) int

Count the number of unique values in the slice based on given function

func Dedup

func Dedup(slice []string) []string

Dedup is function that takes a string slice and removes any duplicates.

func FromEnv

func FromEnv(key, otherwise string) string

FromEnv always returns a string that is either a non-empty value from the environment variable named by key or the string otherwise

func GetDirPath

func GetDirPath(dir string) (string, error)

Look for a directory by increasingly looking up the directory tree by appending '.../' It will look a max of 5 levels up before accepting failure and returning an empty string and an error

func GetEnvBool

func GetEnvBool(varName string, defaultVal bool) bool

func GetEnvFloat

func GetEnvFloat(varName string, defaultVal float64) float64

func GetEnvInt

func GetEnvInt(varName string, defaultVal int) int

func GetPY

func GetPY() int

Get current Performance Year

func IsUUID

func IsUUID(s string) bool

IsUUID returns true if `s` is a UUID.

func MinutesToSeconds

func MinutesToSeconds(minutesStr string) string

MinutesToSeconds converts a minute string to a second string. If the string is invalid or <= 0, it defaults to 5 minutes (300 seconds).

Types

This section is empty.

Jump to

Keyboard shortcuts

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