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

Method RemoveIndex

pkg/util/json/json.go:2460–2475  ·  view source on GitHub ↗
(idx int)

Source from the content-addressed store, hash-verified

2458}
2459
2460func (j jsonArray) RemoveIndex(idx int) (JSON, bool, error) {
2461 if idx < 0 {
2462 idx = len(j) + idx
2463 }
2464 if idx < 0 || idx >= len(j) {
2465 return j, false, nil
2466 }
2467 result := make(jsonArray, len(j)-1)
2468 for i := 0; i < idx; i++ {
2469 result[i] = j[i]
2470 }
2471 for i := idx + 1; i < len(j); i++ {
2472 result[i-1] = j[i]
2473 }
2474 return result, true, nil
2475}
2476
2477func (j jsonObject) RemoveIndex(int) (JSON, bool, error) {
2478 return nil, false, errCannotDeleteFromObject

Callers 1

doRemovePathMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected