utils

package
v1.1.97 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CapitalizeOnlyFirst

func CapitalizeOnlyFirst(s string) string

func ContainerIsRunning

func ContainerIsRunning(container string) (bool, error)

func ContainsString

func ContainsString(content string, searchString string) (value bool, err error)

func EndsWith

func EndsWith(content string, searchString string) (value bool, err error)

func ExecuteCmd

func ExecuteCmd(cmdStr string) *exec.Cmd

func ExecuteCommand

func ExecuteCommand(cmdStr string) (res string, er error)

func ExtractFromRegex

func ExtractFromRegex(content string, regex string) (value []string, err error)

func ExtractOneFromRegex

func ExtractOneFromRegex(content string, regex string) (value string, err error)

func FileExists

func FileExists(filename string) bool

func FileOrString

func FileOrString(s *string)

func GetAbsolutePath

func GetAbsolutePath(filename string) (path string, err error)

func GetBracketedString

func GetBracketedString(s string) string

func GetFirstIndexAndPath

func GetFirstIndexAndPath(expr string) (ind int, path string, err error)

func GetJSONFromHtml

func GetJSONFromHtml(h string) (j map[string]interface{}, err error)

func GetJSONKeys added in v0.9.9

func GetJSONKeys(o globals.JSONObjectGen) ([]string, error)

func GetLimitedString

func GetLimitedString(s string, limit int) string

func GetPathFromExpressionAndVarname

func GetPathFromExpressionAndVarname(varName string, expr string) string

func GetQueries

func GetQueries(s string) ([]string, error)

func GetRandomDoubleInRange

func GetRandomDoubleInRange(min float64, max float64) float64

func GetRandomString

func GetRandomString() string

func GetReadQuery

func GetReadQuery(s string) (string, error)

func GetVarComponents

func GetVarComponents(expr string) (v string, ind int, path string, err error)

func GetWriteQueries

func GetWriteQueries(s string) ([]string, error)

func IsBool

func IsBool(v interface{}) (res bool, value bool)

func IsDouble

func IsDouble(v interface{}) (res bool, value float64)

func IsIntegral

func IsIntegral(val float64) bool

func IsJSONArray

func IsJSONArray(v interface{}) (res bool, t globals.JSONArrayType)

func IsJson

func IsJson(v interface{}) (res bool, value globals.JSONStruct)

func IsNumber

func IsNumber(v interface{}) (res bool, value float64, t globals.StatementParameterTypeBase)

func IsProcessRunningWindows

func IsProcessRunningWindows(processName string) bool

func IsString

func IsString(v interface{}) (res bool, value string)

func JSONDiff

func JSONDiff(first globals.JSONObjectGen, second globals.JSONObjectGen) bool

func NowAsUnixMilli

func NowAsUnixMilli() int64

func ParseHTMLByXPATH

func ParseHTMLByXPATH(content string, xpath string) (value []string, err error)

func ParseHTMLByXPATHAndGetOne

func ParseHTMLByXPATHAndGetOne(content string, xpath string) (value string, err error)

func PerformGetRequestWithFileAttachment

func PerformGetRequestWithFileAttachment(addr string, endpoint string, h http.Header, saveAs string) (res bool, err error)

func PerformPostRequest

func PerformPostRequest(data map[string]string, addr string, endpoint string, logger *evalogger.ILogger, h http.Header) (bodyString string, err error)

func PerformPostRequestWithContent

func PerformPostRequestWithContent(data map[string]string, addr string, endpoint string, logger *evalogger.ILogger, h http.Header, content *string) (bodyString string, err error)

func ReadFile

func ReadFile(filename string) *string

func ReadJSON

func ReadJSON(val string) (globals.JSONStruct, error)

func RemoveFile added in v0.9.3

func RemoveFile(path string) error

func ReplaceAllString

func ReplaceAllString(content string, old string, replacement string) (res string)

func ReplaceBracketsWithDotsInExpr

func ReplaceBracketsWithDotsInExpr(s string) string

func SQLResultToJSON

func SQLResultToJSON(rows *sql.Rows) (globals.JSONArray, error)

func StarsWith

func StarsWith(content string, searchString string) (value bool, err error)

func StringArrayJoin

func StringArrayJoin(a []string, separator string) string

func Trim

func Trim(content string) (res string, err error)

func TrimDoubleQuotedString

func TrimDoubleQuotedString(s *string)

func TrimLeft

func TrimLeft(content string) (res string, err error)

func TrimRight

func TrimRight(content string) (res string, err error)

func TrimSingleQuotedString

func TrimSingleQuotedString(s *string)

func UniqueStrings

func UniqueStrings(in []string) []string

func WriteFile

func WriteFile(dir string, filename string, content []byte) error

func XPATHReplaceEscapedSlashes

func XPATHReplaceEscapedSlashes(xpath *string)

Types

type JSONUtils

type JSONUtils struct {
	VariableExpressionRegexMatcher *regexp.Regexp
	VariableExpressionRegexGrouper *regexp.Regexp
	IndexGrouper                   *regexp.Regexp
	IndexVarGrouper                *regexp.Regexp
	EvalVarExpressionRegexGrouper  *regexp.Regexp
	Verbose                        bool
	Dbg                            bool
}

func NewJSONUtils

func NewJSONUtils() *JSONUtils

func (*JSONUtils) GetIndex

func (s *JSONUtils) GetIndex(a *string) (res bool, value int)

func (*JSONUtils) GetIndexVar

func (s *JSONUtils) GetIndexVar(a *string) (res bool, value string)

func (*JSONUtils) GetJSONVariableExpressionTokens

func (s *JSONUtils) GetJSONVariableExpressionTokens(a *string) (res bool, myVar *[]globals.PathElem)

Jump to

Keyboard shortcuts

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