expression

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Dirs         = "dirs"
	Outputs      = "outputs"
	Random       = "random"
	Params       = "params"
	Globals      = "globals"
	Configs      = "configs"
	Base64Decode = "base64-decode"
	TriggerLabel = "triggers"
)
View Source
const (
	TaskNotJumpOver  SignType = 1 // task 不跳过
	TaskJumpOver     SignType = 0 // task 跳过
	LeftPlaceholder           = "${{"
	RightPlaceholder          = "}}"

	OldLeftPlaceholder  = "${"
	OldRightPlaceholder = "}"
)

Variables

View Source
var MockString = []string{"string", "integer", "integer_length", "float", "boolean", "upper", "lower", "mobile", "digital_letters", "letters", "character", "timestamp",
	"timestamp_hour", "timestamp_after_hour", "timestamp_day", "timestamp_after_day", "timestamp_ms", "timestamp_ms_hour", "timestamp_ms_after_hour",
	"timestamp_ms_day", "timestamp_ms_after_day", "timestamp_ns", "timestamp_ns_hour", "timestamp_ns_after_hour", "timestamp_ns_day",
	"timestamp_ns_after_day", "date", "date_day", "datetime", "datetime_hour"}
View Source
var OldRe = regexp.MustCompile(`\${([^{}]+)}`)

匹配 ${{ xxx }}

Functions

func AppendPlaceholder

func AppendPlaceholder(condition string) string

func DecodeOutputKey added in v1.3.0

func DecodeOutputKey(express string) (string, bool)

func EvalResultToString

func EvalResultToString(result interface{}) (string, error)

func GenAutotestConfigParams added in v1.1.0

func GenAutotestConfigParams(key string) string

func GenConfigParams

func GenConfigParams(key string) string

func GenDirsRef added in v1.1.0

func GenDirsRef(alias string) string

func GenOldParamsRef added in v1.1.0

func GenOldParamsRef(param string) string

func GenOutputRef added in v1.1.0

func GenOutputRef(alias, outputName string) string

func GenParamsRef added in v1.1.0

func GenParamsRef(param string) string

func GenRandomRef added in v1.1.0

func GenRandomRef(key string) string

func MatchEval

func MatchEval(str string, placeholderParams map[string]string, matchType ...string) (string, error)

str 整段包含 ${{}} 的字符串 placeholderParams eval 方法的参数 matchType 匹配那些类型 该方法是将 str 进行正则获取全部匹配的表达式,然后根据匹配的表达式执行 eval 方法,最后将表达式替换成执行的值

func Quote added in v1.2.2

func Quote(s string) string

func ReplacePlaceholder

func ReplacePlaceholder(condition string) string

func ReplaceRandomParams

func ReplaceRandomParams(ori string) string

Types

type ExpressionExecSign

type ExpressionExecSign struct {
	Sign      SignType
	Msg       string
	Err       error
	Condition string
}

func Reconcile

func Reconcile(condition string) (sign ExpressionExecSign)

type SignType

type SignType int

Jump to

Keyboard shortcuts

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