util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(sslice []string, searchString string) bool

Contains checks whether the given string slice contains the searchString.

func HasAnyPrefix

func HasAnyPrefix(prefixes []string, theString string) bool

HasAnyPrefix checks whether the given string starts with any of the prefixes.

func HumanizeDuration

func HumanizeDuration(d time.Duration) string

HumanizeDuration may be used to increase readability of a timestamp.

func HumanizeTimestamp

func HumanizeTimestamp(t time.Time) string

HumanizeTimestamp may be used to increase readability of a timestamp.

func IsSlicesEqual

func IsSlicesEqual(sslice1, sslice2 []string) bool

IsSlicesEqual check whether the given slice have equal content but not necessarily in the same order.

func NewLogger

func NewLogger() log.Logger

NewLogger returns a new Logger with log level configured.

func NormalizeString

func NormalizeString(theString string) string

NormalizeString trims spaces and returns the string in lower case.

func NormalizeStringSlice

func NormalizeStringSlice(sslice []string) []string

NormalizeStringSlice normalizes all strings of the given slice.

func ParseClusterFromString

func ParseClusterFromString(theString string) ([]string, error)

ParseClusterFromString returns the cluster names found in the given string or an error.

func RemoveDuplicates

func RemoveDuplicates(stringSlice []string) []string

RemoveDuplicates does what it says on the given string slice.

func StringToTimestamp

func StringToTimestamp(theString string) time.Time

StringToTimestamp converts a string to RFC 3339 timestamp.

func TimeEndOfDay

func TimeEndOfDay() time.Time

func TimeStartOfDay

func TimeStartOfDay() time.Time

func TimestampToString

func TimestampToString(ts time.Time) string

TimestampToString converts the given time to RFC 3339 format string.

func ToSlackTable

func ToSlackTable(values [][]string) *slack.Msg

ToSlackTable create a 2 column slack table using the TextBlockObjects. The input shall look like:

[][]string{
  {"headerColumn1", "headerColumn2"},
	 {"valueLine1", "valueLine2"},
}

func TrimAnyPrefix

func TrimAnyPrefix(prefixes []string, theString string) string

TrimAnyPrefix trims any of the given prefixes from the string

Types

This section is empty.

Jump to

Keyboard shortcuts

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