pagePrintBranch prints the data for a leaf page.
(w io.Writer, buf []byte)
| 184 | |
| 185 | // pagePrintBranch prints the data for a leaf page. |
| 186 | func pagePrintBranch(w io.Writer, buf []byte) error { |
| 187 | p := common.LoadPage(buf) |
| 188 | |
| 189 | // print number of items. |
| 190 | fmt.Fprintf(w, "Item Count: %d\n", p.Count()) |
| 191 | fmt.Fprintf(w, "\n") |
| 192 | |
| 193 | // print each key/value. |
| 194 | for i := uint16(0); i < p.Count(); i++ { |
| 195 | e := p.BranchPageElement(i) |
| 196 | |
| 197 | // format key as string. |
| 198 | var k string |
| 199 | if isPrintable(string(e.Key())) { |
| 200 | k = fmt.Sprintf("%q", string(e.Key())) |
| 201 | } else { |
| 202 | k = fmt.Sprintf("%x", string(e.Key())) |
| 203 | } |
| 204 | |
| 205 | fmt.Fprintf(w, "%s: <pgid=%d>\n", k, e.Pgid()) |
| 206 | } |
| 207 | fmt.Fprintf(w, "\n") |
| 208 | return nil |
| 209 | } |
| 210 | |
| 211 | // pagePrintFreelist prints the data for a freelist page. |
| 212 | func pagePrintFreelist(w io.Writer, buf []byte) error { |
no test coverage detected