MCPcopy Create free account
hub / github.com/dolthub/doltgresql / iterObject

Method iterObject

postgres/parser/json/encoded.go:269–295  ·  view source on GitHub ↗

iterObject iterates through all the keys and values of an encoded object without requiring decoding of all of them.

()

Source from the content-addressed store, hash-verified

267// iterObject iterates through all the keys and values of an encoded object
268// without requiring decoding of all of them.
269func (j *jsonEncoded) iterObject() (encodedObjectIterator, error) {
270 if j.typ != ObjectJSONType {
271 panic("can only iterate through the object values of an object")
272 }
273
274 curKeyIdx := containerHeaderLen + j.containerLen*jEntryLen*2
275 curValueIdx := curKeyIdx
276
277 // We have to seek to the start of the value data.
278 for i := 0; i < j.containerLen; i++ {
279 entry, err := getJEntryAt(j.value, containerHeaderLen+i*jEntryLen, curValueIdx-curKeyIdx)
280 if err != nil {
281 return encodedObjectIterator{}, err
282 }
283 curValueIdx += int(entry.length)
284 }
285
286 return encodedObjectIterator{
287 curKeyIdx: 0,
288 keyOffset: curKeyIdx,
289 curValueIdx: 0,
290 valueOffset: curValueIdx,
291 len: j.containerLen,
292 idx: 0,
293 data: j.value,
294 }, nil
295}
296
297func (j *jsonEncoded) StripNulls() (JSON, bool, error) {
298 dec, err := j.shallowDecode()

Callers 1

shallowDecodeMethod · 0.95

Calls 1

getJEntryAtFunction · 0.85

Tested by

no test coverage detected