(depth int)
| 1828 | } |
| 1829 | |
| 1830 | func (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 | |
| 1853 | func (j jsonObject) allPathsWithDepth(depth int) ([]JSON, error) { |
| 1854 | if len(j) == 0 || depth == 0 { |
nothing calls this directly
no test coverage detected