(bf *Stream, tab *model.Table)
| 41 | } |
| 42 | |
| 43 | func printTablePBT(bf *Stream, tab *model.Table) bool { |
| 44 | |
| 45 | if len(tab.Recs) == 0 { |
| 46 | return true |
| 47 | } |
| 48 | |
| 49 | bf.Printf("%s: [\n", tab.LocalFD.Name) |
| 50 | |
| 51 | // 遍历每一行 |
| 52 | for recIndex, r := range tab.Recs { |
| 53 | |
| 54 | bf.Printf(" {") |
| 55 | |
| 56 | // 遍历每一列 |
| 57 | for rootFieldIndex, node := range r.Nodes { |
| 58 | |
| 59 | if node.SugguestIgnore && !node.IsRepeated { |
| 60 | continue |
| 61 | } |
| 62 | |
| 63 | if node.IsRepeated { |
| 64 | bf.Printf("%s:[ ", node.Name) |
| 65 | } else { |
| 66 | bf.Printf("%s: ", node.Name) |
| 67 | } |
| 68 | |
| 69 | // 普通值 |
| 70 | if node.Type != model.FieldType_Struct { |
| 71 | |
| 72 | if node.IsRepeated { |
| 73 | |
| 74 | // repeated 值序列 |
| 75 | for arrIndex, valueNode := range node.Child { |
| 76 | |
| 77 | bf.Printf("%s", valueWrapperPbt(node.Type, valueNode)) |
| 78 | |
| 79 | // 多个值分割 |
| 80 | if arrIndex < len(node.Child)-1 { |
| 81 | bf.Printf(", ") |
| 82 | } |
| 83 | |
| 84 | } |
| 85 | } else { |
| 86 | // 单值 |
| 87 | valueNode := node.Child[0] |
| 88 | |
| 89 | bf.Printf("%s", valueWrapperPbt(node.Type, valueNode)) |
| 90 | |
| 91 | } |
| 92 | |
| 93 | } else { |
| 94 | |
| 95 | // 遍历repeated的结构体 |
| 96 | for structIndex, structNode := range node.Child { |
| 97 | |
| 98 | // 结构体开始 |
| 99 | bf.Printf("{ ") |
| 100 |
no test coverage detected