add a 'Upper' expr helper (#50)
* add a 'Upper' expr helper * remove redundant startsWith and endsWith
This commit is contained in:
parent
f2e38b0d28
commit
430b7cd90d
|
@ -24,23 +24,18 @@ func Atof(x string) float64 {
|
|||
return ret
|
||||
}
|
||||
|
||||
func StartsWith(s string, pref string) bool {
|
||||
return strings.HasPrefix(s, pref)
|
||||
}
|
||||
|
||||
func EndsWith(s string, suff string) bool {
|
||||
return strings.HasSuffix(s, suff)
|
||||
func Upper(s string) string {
|
||||
return strings.ToUpper(s)
|
||||
}
|
||||
|
||||
func GetExprEnv(ctx map[string]interface{}) map[string]interface{} {
|
||||
var ExprLib = map[string]interface{}{
|
||||
"Atof": Atof,
|
||||
"StartsWith": StartsWith,
|
||||
"EndsWith" : EndsWith,
|
||||
"JsonExtract": JsonExtract,
|
||||
"Atof": Atof,
|
||||
"JsonExtract": JsonExtract,
|
||||
"JsonExtractLib": JsonExtractLib,
|
||||
"File": File,
|
||||
"RegexpInFile": RegexpInFile,
|
||||
"File": File,
|
||||
"RegexpInFile": RegexpInFile,
|
||||
"Upper": Upper,
|
||||
}
|
||||
for k, v := range ctx {
|
||||
ExprLib[k] = v
|
||||
|
|
Loading…
Reference in a new issue