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

Method RemoveString

pkg/util/json/json.go:2432–2442  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

2430}
2431
2432func (j jsonObject) RemoveString(s string) (JSON, bool, error) {
2433 idx, ok := findPairIndexByKey(j, s)
2434 if !ok {
2435 return j, false, nil
2436 }
2437
2438 newVal := make([]jsonKeyValuePair, len(j)-1)
2439 copy(newVal, j[:idx])
2440 copy(newVal[idx:], j[idx+1:])
2441 return jsonObject(newVal), true, nil
2442}
2443
2444func (jsonNull) RemoveString(string) (JSON, bool, error) {
2445 return nil, false, errCannotDeleteFromScalar

Callers 1

doRemovePathMethod · 0.95

Calls 2

findPairIndexByKeyFunction · 0.85
jsonObjectTypeAlias · 0.85

Tested by

no test coverage detected