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

Method allPathsWithDepth

pkg/util/json/json.go:1830–1851  ·  view source on GitHub ↗
(depth int)

Source from the content-addressed store, hash-verified

1828}
1829
1830func (j jsonArray) allPathsWithDepth(depth int) ([]JSON, error) {
1831 if len(j) == 0 || depth == 0 {
1832 return []JSON{j}, nil
1833 }
1834 ret := make([]JSON, 0, len(j))
1835 for i := range j {
1836 var paths []JSON
1837 var err error
1838 if depth > 0 {
1839 paths, err = j[i].allPathsWithDepth(depth - 1)
1840 } else {
1841 paths, err = j[i].allPathsWithDepth(depth)
1842 }
1843 if err != nil {
1844 return nil, err
1845 }
1846 for _, path := range paths {
1847 ret = append(ret, jsonArray{path})
1848 }
1849 }
1850 return ret, nil
1851}
1852
1853func (j jsonObject) allPathsWithDepth(depth int) ([]JSON, error) {
1854 if len(j) == 0 || depth == 0 {

Callers

nothing calls this directly

Calls 1

allPathsWithDepthMethod · 0.65

Tested by

no test coverage detected