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

Method RemoveString

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

Source from the content-addressed store, hash-verified

1332}
1333
1334func (j jsonObject) RemoveString(s string) (JSON, bool, error) {
1335 idx, ok := findPairIndexByKey(j, s)
1336 if !ok {
1337 return j, false, nil
1338 }
1339
1340 newVal := make([]jsonKeyValuePair, len(j)-1)
1341 for i, elem := range j[:idx] {
1342 newVal[i] = elem
1343 }
1344 for i, elem := range j[idx+1:] {
1345 newVal[idx+i] = elem
1346 }
1347 return jsonObject(newVal), true, nil
1348}
1349
1350func (jsonNull) RemoveString(string) (JSON, bool, error) { return nil, false, errCannotDeleteFromScalar }
1351func (jsonTrue) RemoveString(string) (JSON, bool, error) { return nil, false, errCannotDeleteFromScalar }

Callers 1

doRemovePathMethod · 0.95

Calls 2

findPairIndexByKeyFunction · 0.85
jsonObjectTypeAlias · 0.85

Tested by

no test coverage detected