utils

package
v0.0.0-...-dafbf60 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates hash blocksize <= 0.
	ErrInvalidBlockSize = errors.New("invalid blocksize")

	// ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unPad.
	ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)")

	// ErrInvalidPKCS7Padding indicates PKCS7 unPad fails to bad input.
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

Functions

func AgeToSeconds

func AgeToSeconds(s string) int64

AgeToSeconds extents timeDuration functions from time package

func AgeToUnixTime

func AgeToUnixTime(s string) int64

AgeToUnixTime Helper function to get the Unix Time

func ArchiveFile

func ArchiveFile(inputPath string, outputPath string)

ArchiveFile archives file from input

func DeleteFile

func DeleteFile(path string)

DeleteFile deletes file

func Encrypt

func Encrypt(plainstring string, passphrase string) string

Encrypt function

func GetEnv

func GetEnv(key, fallback string) string

GetEnv exports env value or gives default value

func GetJsonKeyValue

func GetJsonKeyValue(jsonData string, keyName string) (string, error)

GetJsonKeyValue retrives json key from a json object

func SliceContainsDuplicatesStrings

func SliceContainsDuplicatesStrings(list []string) bool

Check if string slice has duplicates or more strings

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice checks if string not in slice

func StringInSliceCount

func StringInSliceCount(a string, list []string) int

Counts number of strings in string slice

func TagInSlice

func TagInSlice(key string, value string, tags []map[string]string) bool

TagInSlice checks if Tag is present in a list of Tags

Types

This section is empty.

Jump to

Keyboard shortcuts

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