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

Method StripNulls

pkg/util/json/json.go:2646–2667  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2644 return j, false, nil
2645}
2646func (j jsonArray) StripNulls() (JSON, bool, error) {
2647 for i, e := range j {
2648 json, needToStrip, err := e.StripNulls()
2649 if err != nil {
2650 return nil, false, err
2651 }
2652 if needToStrip {
2653 // Cannot return the original content, need to return the result
2654 // with new JSON array.
2655 newArr := make(jsonArray, 0, len(j))
2656 newArr = append(append(newArr, j[:i]...), json)
2657 for _, elem := range j[i+1:] {
2658 if json, _, err = elem.StripNulls(); err != nil {
2659 return nil, false, err
2660 }
2661 newArr = append(newArr, json)
2662 }
2663 return newArr, true, nil
2664 }
2665 }
2666 return j, false, nil
2667}
2668func (j jsonObject) StripNulls() (JSON, bool, error) {
2669 for i, e := range j {
2670 var json JSON

Callers

nothing calls this directly

Calls 1

StripNullsMethod · 0.65

Tested by

no test coverage detected