resolveMathMultiply resolves a multiply transform, returning an error if the input is not a number. If the input is a float, the result will be a float64, otherwise it will be an int64.
(t *v1beta1.MathTransform, input any)
| 123 | // input is not a number. If the input is a float, the result will be a float64, otherwise |
| 124 | // it will be an int64. |
| 125 | func resolveMathMultiply(t *v1beta1.MathTransform, input any) (any, error) { |
| 126 | switch i := input.(type) { |
| 127 | case int: |
| 128 | return int64(i) * *t.Multiply, nil |
| 129 | case int64: |
| 130 | return i * *t.Multiply, nil |
| 131 | case float64: |
| 132 | return i * float64(*t.Multiply), nil |
| 133 | default: |
| 134 | return nil, errors.Errorf(errFmtMathInputNonNumber, input) |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | // resolveMathClamp resolves a clamp transform, returning an error if the input |
| 139 | // is not a number. depending on the type of clamp, the result will be either |