utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPathFromExtraSlashes added in v1.1.0

func CleanPathFromExtraSlashes(target string) string

func DirExistAndHasContent

func DirExistAndHasContent(dirPath string) error

func ExtractBearerValueFromHeader added in v1.1.0

func ExtractBearerValueFromHeader(headerValue string) (string, error)

func FileExistAndItIsAFile

func FileExistAndItIsAFile(filePath string) error

func FileIsNotEmpty

func FileIsNotEmpty(filepath string) error

func FindGitRepoDir

func FindGitRepoDir(levels int) (string, error)

func FindStrInMapKeys added in v1.1.0

func FindStrInMapKeys(m map[string]string, str string) (string, error)

func FindStrInMapValues added in v1.1.0

func FindStrInMapValues(m map[string]string, str string) (string, error)

func FindStrInSlice added in v1.1.0

func FindStrInSlice(slice []string, str string) (string, error)

func GenerateRandomString

func GenerateRandomString(opt RandomStringOptions) string

func GetCommandArgs

func GetCommandArgs(cmd string) ([]string, error)

GetCommandArgs parses the job command and returns the arguments.

func GetCurrentDir

func GetCurrentDir() string

func GetHomeDir

func GetHomeDir() string

func GetUUID

func GetUUID() string

func IsHTTPVerbValid added in v1.1.0

func IsHTTPVerbValid(ver string) error

func KeyInMapHasValueSet added in v1.1.0

func KeyInMapHasValueSet(m map[string]string, keyInMap string) error

func MapIsNulOrEmpty

func MapIsNulOrEmpty(target map[string]string) bool

func MergeSlices

func MergeSlices(slices ...[]string) []string

func NewUnixTimeWithAddedMinutes added in v1.1.0

func NewUnixTimeWithAddedMinutes(number int64) int64

func NewValidator added in v1.1.0

func NewValidator() *validator.Validate

func NormaliseStringToLower

func NormaliseStringToLower(target string) string

func NormaliseStringToUpper

func NormaliseStringToUpper(target string) string

func RemoveDoubleQuotes

func RemoveDoubleQuotes(target string) string

func RunCommand

func RunCommand(cmd Command) (string, error)

RunCommand runs a command and returns the output.

func ValidateAuthorizationHeader added in v1.1.0

func ValidateAuthorizationHeader(headers map[string]string) error

func ValidateBearerTokenSchema added in v1.1.0

func ValidateBearerTokenSchema(headerContent string) error

func ValidatorErrors added in v1.1.0

func ValidatorErrors(err error) map[string]string

ValidatorErrors func for show validation errors for each invalid fields.

func ValueInMapIsNotEmptyByKey added in v1.1.0

func ValueInMapIsNotEmptyByKey(target map[string]string, key string) (string, error)

func WrapAtLength

func WrapAtLength(input string, length int) string

WrapAtLength wraps the input paragraph at the specified length

func WriteFileWithContent

func WriteFileWithContent(filename string, content []byte) error

Types

type Command

type Command struct {
	Binary   string
	Commands []string
}

type RandomStringOptions

type RandomStringOptions struct {
	Length            int
	AllowSpecialChars bool
	UpperLowerRandom  bool
}

Jump to

Keyboard shortcuts

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