CheckForNullThenError returns the first element of vecs with the null type. If no element has the null type, it returns the first element with an error type.
(vecs []vector.Any)
| 16 | // type. If no element has the null type, it returns the first element with an |
| 17 | // error type. |
| 18 | func CheckForNullThenError(vecs []vector.Any) (vector.Any, bool) { |
| 19 | var errVec vector.Any |
| 20 | for _, vec := range vecs { |
| 21 | if k := vec.Kind(); k == vector.KindNull { |
| 22 | return vec, true |
| 23 | } else if k == vector.KindError && errVec == nil { |
| 24 | errVec = vec |
| 25 | } |
| 26 | } |
| 27 | return errVec, errVec != nil |
| 28 | } |
| 29 | |
| 30 | type Call struct { |
| 31 | fn Function |