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

Method getNthEntryBounds

postgres/parser/json/encoded.go:326–341  ·  view source on GitHub ↗

getNthEntryBounds returns the beginning, ending, and JEntry of the nth entry in the container. If the container is an object, the i-th entry is the i-th key, and the (i+length)-th entry is the i-th value.

(n int)

Source from the content-addressed store, hash-verified

324// in the container. If the container is an object, the i-th entry is the i-th
325// key, and the (i+length)-th entry is the i-th value.
326func (j *jsonEncoded) getNthEntryBounds(n int) (begin, end int, entry jEntry, err error) {
327 // First, we seek for the beginning of the current entry by stepping
328 // backwards via beginningOfIdx.
329 begin, err = j.beginningOfIdx(n)
330 if err != nil {
331 return 0, 0, jEntry{}, err
332 }
333
334 // Once we know where this entry starts, we can derive the end from its own
335 // JEntry.
336 entry, err = j.nthJEntry(n, begin)
337 if err != nil {
338 return 0, 0, jEntry{}, err
339 }
340 return begin, begin + int(entry.length), entry, nil
341}
342
343// objectGetNthDataRange returns the byte subslice and jEntry of the given nth entry.
344// If the container is an object, the i-th entry is the i-th key, and the

Callers 2

objectGetNthDataRangeMethod · 0.95
FetchValIdxMethod · 0.95

Calls 2

beginningOfIdxMethod · 0.95
nthJEntryMethod · 0.95

Tested by

no test coverage detected