PrependToMaybeNullArray prepends an element in the front of an arrray. If the argument is NULL, an array of one element is created.
(typ *types.T, left Datum, right Datum)
| 292 | // PrependToMaybeNullArray prepends an element in the front of an arrray. |
| 293 | // If the argument is NULL, an array of one element is created. |
| 294 | func PrependToMaybeNullArray(typ *types.T, left Datum, right Datum) (Datum, error) { |
| 295 | result := NewDArray(typ) |
| 296 | if err := result.Append(left); err != nil { |
| 297 | return nil, err |
| 298 | } |
| 299 | if right != DNull { |
| 300 | for _, e := range MustBeDArray(right).Array { |
| 301 | if err := result.Append(e); err != nil { |
| 302 | return nil, err |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | return result, nil |
| 307 | } |
| 308 | |
| 309 | // TODO(justin): these might be improved by making arrays into an interface and |
| 310 | // then introducing a ConcatenatedArray implementation which just references two |
nothing calls this directly
no test coverage detected
searching dependent graphs…