utils

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDiscoverYML

func AutoDiscoverYML(path string) ([]string, error)

AutoDiscoverYML find yaml in given path

func Base64Encode

func Base64Encode(s string) string

Base64Encode encodes a string to base64

func BytesContainsString

func BytesContainsString(b []byte, s string) bool

BytesContainsString checks if a byte slice contains a string

func BytesContainsStringTimes added in v3.2.0

func BytesContainsStringTimes(b []byte, s string) int

BytesContainsStringXTimes checks if a byte slice contains a string x times

func BytesToLowerCase

func BytesToLowerCase(b []byte) []byte

BytesToLowerCase converts all bytes in a byte slice to lowercase

func CamelCaseToSnakeCase added in v3.2.0

func CamelCaseToSnakeCase(s string) string

CamelCaseToSnakeCase converts a string from camel case to snake case

func EnvToMap

func EnvToMap() map[string]string

EnvToMap returns a map of environment variables from the given environment

func EqualSlices

func EqualSlices[T comparable](a, b []T) bool

EqualSlices checks if two slices are equal

func ExtractFileNameWithoutExtension

func ExtractFileNameWithoutExtension(path string) string

ExtractFileNameWithoutExtension extracts the file name without extension

func HTMLStripTags

func HTMLStripTags(s string) string

HTMLStripTags removes all HTML tags from a string

func Include

func Include(slice []string, str string) bool

Include checks if a string is included in a slice

func IsHeadless added in v3.1.0

func IsHeadless() bool

isHeadless returns true if user doesn't have a graphical environment

func Map2Hash added in v3.3.0

func Map2Hash(m map[string]string) string

Map2Hash converts a map to a hash

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func PrintTable

func PrintTable(table [][]string)

PrintTable prints a table

func SetLogLevelFromStr

func SetLogLevelFromStr(level string)

SetLogLevelFromStr sets the log level from a string

func StringToInt added in v3.1.0

func StringToInt(s string) int

StringToInt converts a string to an int

func TakeScreenshotWithChromedp

func TakeScreenshotWithChromedp(url, file string) error

TakeScreenshotWithChromedp takes a screenshot of the current browser window.

Types

This section is empty.

Jump to

Keyboard shortcuts

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