utl

package module
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 14 Imported by: 1

README

utl

Common utilities housekeeping functions

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Red  = color.FgLightRed.Render
	Blu  = color.FgLightBlue.Render
	Gre  = color.FgGreen.Render
	Yel  = color.FgYellow.Render
	Whi  = color.FgWhite.Render
	Cya  = color.FgCyan.Render
	Mag  = color.FgLightMagenta.Render
	Gra  = color.FgDarkGray.Render
	Red2 = color.FgRed.Render
	Blu2 = color.FgBlue.Render
	Gre2 = color.FgLightGreen.Render
	Yel2 = color.FgLightYellow.Render
	Whi2 = color.FgLightWhite.Render
	Cya2 = color.FgLightCyan.Render
	Mag2 = color.FgMagenta.Render
)

Functions

func ConvertDateFormat added in v1.1.2

func ConvertDateFormat(dateString, fromFormat, toFormat string) (string, error)

func DateStringToEpocInt64 added in v1.1.2

func DateStringToEpocInt64(dateString, dateFormat string) (int64, error)

func Die

func Die(format string, args ...interface{})

func EpocIntToTime added in v1.1.2

func EpocIntToTime(epocInt int64) time.Time

func EpocStringToTime added in v1.1.2

func EpocStringToTime(epocString string) (time.Time, error)

func FileExist

func FileExist(filePath string) (e bool)

func FileModTime

func FileModTime(filePath string) int

func FileNotExist

func FileNotExist(filePath string) (e bool)

func FileSize

func FileSize(filePath string) int64

func FileUsable

func FileUsable(filePath string) (e bool)

func FirstN added in v1.1.3

func FirstN(s string, n int) string

func GetType added in v1.0.0

func GetType(v interface{}) string

func IntAbs added in v1.1.2

func IntAbs(val int64) int64

func IsHexDigit added in v1.0.6

func IsHexDigit(c rune) bool

func ItemInList

func ItemInList(arg string, argList []string) bool

func LastElem

func LastElem(s, splitter string) string

func LoadFileJson

func LoadFileJson(filePath string) (jsonObject interface{}, err error)

func LoadFileYaml

func LoadFileYaml(filePath string) (yamlObject interface{}, err error)

func MergeMaps

func MergeMaps(m1, m2 map[string]string) (result map[string]string)

func MergeObjects

func MergeObjects(x, y map[string]interface{}) (obj map[string]interface{})

func PadSpaces

func PadSpaces(targetWidth, stringWidth int) string

func Prettify

func Prettify(jsonObject interface{}) (pretty string, err error)

func PrintColorSamples added in v1.0.14

func PrintColorSamples()

func PrintDateInDays added in v1.1.2

func PrintDateInDays(days string)

func PrintDays added in v1.1.2

func PrintDays(days int64)

func PrintDaysBetween added in v1.1.2

func PrintDaysBetween(date1, date2 string)

func PrintDaysSinceOrTo added in v1.1.2

func PrintDaysSinceOrTo(date1 string)

func PrintJson

func PrintJson(jsonObject interface{})

func PrintYaml

func PrintYaml(yamlObject interface{})

func PromptMsg added in v1.0.13

func PromptMsg(msg string) rune

func RemoveFile

func RemoveFile(filePath string)

func SameType

func SameType(a, b interface{}) bool

func SaveFileJson

func SaveFileJson(jsonObject interface{}, filePath string)

func SaveFileYaml

func SaveFileYaml(yamlObject interface{}, filePath string)

func SortMapStringKeys added in v1.1.1

func SortMapStringKeys(obj map[string]string) (sortedKeys []string)

TODO: Combine below two func with interfaces

func SortObjStringKeys added in v1.1.1

func SortObjStringKeys(obj map[string]interface{}) (sortedKeys []string)

func Str added in v1.0.2

func Str(x interface{}) string

func StringToInt64 added in v1.1.2

func StringToInt64(s string) (int64, error)

func SubString

func SubString(large, small string) bool

func Trace

func Trace() string

func ValidDate added in v1.1.4

func ValidDate(dateString, expectedFormat string) bool

func ValidUuid

func ValidUuid(s string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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