evalCodeExpr handles non-string expressions (arithmetic, comparison, boolean).
(expression string, targetType workflow.DataType, refs []Value)
| 110 | result[plIdx] = result[plIdx].Cast(targetType) |
| 111 | expression = expression[:loc[0]] + "${}" + expression[loc[1]:] |
| 112 | } |
| 113 | return expression, result |
| 114 | } |
| 115 | |
| 116 | // evalCodeExpr handles non-string expressions (arithmetic, comparison, boolean). |
| 117 | func evalCodeExpr(expression string, targetType workflowapi.DataType, refs []Value) (Value, error) { |
| 118 | expression, refs = applyCastsInCode(expression, refs) |
| 119 | |
| 120 | if expression == "${}" && len(refs) == 1 { |
| 121 | return refs[0].Cast(targetType), nil |
| 122 | } |
| 123 | |
| 124 | idx := 0 |
| 125 | resolved := placeholderRE.ReplaceAllStringFunc(expression, func(_ string) string { |
| 126 | v := refs[idx] |
| 127 | idx++ |
| 128 | return valueToLiteral(v) |
| 129 | }) |
| 130 | resolved = strings.TrimSpace(resolved) |
| 131 |
no test coverage detected