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

Method RemoveIndex

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

Source from the content-addressed store, hash-verified

1360}
1361
1362func (j jsonArray) RemoveIndex(idx int) (JSON, bool, error) {
1363 if idx < 0 {
1364 idx = len(j) + idx
1365 }
1366 if idx < 0 || idx >= len(j) {
1367 return j, false, nil
1368 }
1369 result := make(jsonArray, len(j)-1)
1370 for i := 0; i < idx; i++ {
1371 result[i] = j[i]
1372 }
1373 for i := idx + 1; i < len(j); i++ {
1374 result[i-1] = j[i]
1375 }
1376 return result, true, nil
1377}
1378
1379func (j jsonObject) RemoveIndex(int) (JSON, bool, error) {
1380 return nil, false, errCannotDeleteFromObject

Callers 1

doRemovePathMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected