arrayCount returns the number of elements appended so far to the array table at the given path.
(key []byte)
| 387 | // arrayCount returns the number of elements appended so far to the array |
| 388 | // table at the given path. |
| 389 | func (d *decoder) arrayCount(key []byte) int { |
| 390 | if d.arrayCounts == nil { |
| 391 | return 0 |
| 392 | } |
| 393 | if p := d.arrayCounts[string(key)]; p != nil { // does not allocate |
| 394 | return *p |
| 395 | } |
| 396 | return 0 |
| 397 | } |
| 398 | |
| 399 | func (d *decoder) setArrayCount(key []byte, n int) { |
| 400 | if d.arrayCounts == nil { |