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

Method StripNulls

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

Source from the content-addressed store, hash-verified

1545 return j, false, nil
1546}
1547func (j jsonArray) StripNulls() (JSON, bool, error) {
1548 for i, e := range j {
1549 json, needToStrip, err := e.StripNulls()
1550 if err != nil {
1551 return nil, false, err
1552 }
1553 if needToStrip {
1554 // Cannot return the original content, need to return the result
1555 // with new JSON array.
1556 newArr := make(jsonArray, 0, len(j))
1557 newArr = append(append(newArr, j[:i]...), json)
1558 for _, elem := range j[i+1:] {
1559 if json, _, err = elem.StripNulls(); err != nil {
1560 return nil, false, err
1561 }
1562 newArr = append(newArr, json)
1563 }
1564 return newArr, true, nil
1565 }
1566 }
1567 return j, false, nil
1568}
1569func (j jsonObject) StripNulls() (JSON, bool, error) {
1570 for i, e := range j {
1571 var json JSON

Callers

nothing calls this directly

Calls 1

StripNullsMethod · 0.65

Tested by

no test coverage detected