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

Method nextEncoded

pkg/util/json/encoded.go:173–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171}
172
173func (e *encodedArrayIterator) nextEncoded() (nextJEntry jEntry, next []byte, ok bool, err error) {
174 if e.idx >= e.len {
175 return jEntry{}, nil, false, nil
176 }
177
178 // Recall the layout of an encoded array:
179 // [ container header ] [ all JEntries ] [ all values ]
180 nextJEntry, err = getJEntryAt(e.data, containerHeaderLen+e.idx*jEntryLen, e.curDataIdx)
181 if err != nil {
182 return jEntry{}, nil, false, err
183 }
184 nextLen := int(nextJEntry.length)
185 nextData := e.data[e.dataOffset+e.curDataIdx : e.dataOffset+e.curDataIdx+nextLen]
186 e.idx++
187 e.curDataIdx += nextLen
188 return nextJEntry, nextData, true, nil
189}
190
191// iterArrayValues iterates through all the values of an encoded array without
192// requiring decoding of all of them.

Callers 2

shallowDecodeMethod · 0.45
ExistsMethod · 0.45

Calls 1

getJEntryAtFunction · 0.85

Tested by

no test coverage detected