pexpr

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoosePhRe = regexp.MustCompile(`\${{[^{}]+}}`)

loosePhRe 宽松的正则表达式:

View Source
var PhRe = regexp.MustCompile(`\${{[ ]{1}([^{}\s]+)[ ]{1}}}`) // [ ]{1} 强调前后均有且仅有一个空格

phRe 占位符正则表达式:

${{ configs.key }}
${{ dirs.preTaskName.fileName }}
${{ outputs.preTaskName.key }}
${{ params.key }}
${{ (echo hello world) }}

Functions

func Eval

func Eval(exprStr string, placeholderParams map[string]string) (interface{}, error)

Eval 递归渲染统一表达式语法里的占位符,再计算表达式结果 exprStr: 表达式 placeholderParams: 占位符参数

func FindInvalidPlaceholders

func FindInvalidPlaceholders(exprStr string) []string

FindInvalidPlaceholders 找到表达式中不合规范的占位符

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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