utils

package
v0.0.0-...-58380e1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendIfNew

func AppendIfNew(strList []string, newItem string) []string

AppendIfNew add item to string array if not already in slice

func CastNumberAsFloat64

func CastNumberAsFloat64(val any) (float64, error)

func Find

func Find(slice []string, val string) (int, bool)

Find takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

func GenerateRandomInt

func GenerateRandomInt(min, max int) int

func GenericJSONParsing

func GenericJSONParsing[T any](filePath string) (T, error)

GenericJSONParsing Parse into struct

func GenericYAMLParsing

func GenericYAMLParsing[T any](filePath string) (T, error)

GenericYAMLParsing Parse into struct

func GetFileAsLines

func GetFileAsLines(filePath string, maxLineLength ...int) ([]string, error)

GetFileAsLines reads a file and return the content as a string array.

If some processed lines are longer than 65536 characters, maxLineLength needs to be added as an argument.

func IsALetter

func IsALetter(element byte) bool

IsALetter Check if char is an ASCII letter or not

func PrintMemUsage

func PrintMemUsage()

func ValueEqual

func ValueEqual[T comparable](item1, item2 *T) bool

ValueEqual check that 2 pointers to comparable items point to values that are equal

Types

This section is empty.

Jump to

Keyboard shortcuts

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