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)
| 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. |
| 326 | func (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 |
no test coverage detected