(pageBytes []byte, index uint16)
| 98 | } |
| 99 | |
| 100 | func pageItemLeafPageElement(pageBytes []byte, index uint16) ([]byte, []byte, error) { |
| 101 | p := common.LoadPage(pageBytes) |
| 102 | if index >= p.Count() { |
| 103 | return nil, nil, fmt.Errorf("leafPageElement: expected item index less than %d, but got %d", p.Count(), index) |
| 104 | } |
| 105 | if p.Typ() != "leaf" { |
| 106 | return nil, nil, fmt.Errorf("leafPageElement: expected page type of 'leaf', but got '%s'", p.Typ()) |
| 107 | } |
| 108 | |
| 109 | e := p.LeafPageElement(index) |
| 110 | return e.Key(), e.Value(), nil |
| 111 | } |