MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / AppendToMaybeNullArray

Function AppendToMaybeNullArray

pkg/sql/sem/tree/eval.go:277–290  ·  view source on GitHub ↗

AppendToMaybeNullArray appends an element to an array. If the first argument is NULL, an array of one element is created.

(typ *types.T, left Datum, right Datum)

Source from the content-addressed store, hash-verified

275// AppendToMaybeNullArray appends an element to an array. If the first
276// argument is NULL, an array of one element is created.
277func AppendToMaybeNullArray(typ *types.T, left Datum, right Datum) (Datum, error) {
278 result := NewDArray(typ)
279 if left != DNull {
280 for _, e := range MustBeDArray(left).Array {
281 if err := result.Append(e); err != nil {
282 return nil, err
283 }
284 }
285 }
286 if err := result.Append(right); err != nil {
287 return nil, err
288 }
289 return result, nil
290}
291
292// PrependToMaybeNullArray prepends an element in the front of an arrray.
293// If the argument is NULL, an array of one element is created.

Callers

nothing calls this directly

Calls 3

AppendMethod · 0.95
NewDArrayFunction · 0.85
MustBeDArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…