(out io.Writer)
| 137 | } |
| 138 | |
| 139 | func (s *folderDB) DebugCounts(out io.Writer) error { |
| 140 | type deviceCountsRow struct { |
| 141 | countsRow |
| 142 | |
| 143 | DeviceID string |
| 144 | } |
| 145 | |
| 146 | delMap := map[bool]string{ |
| 147 | true: "del", |
| 148 | false: "---", |
| 149 | } |
| 150 | |
| 151 | var res []deviceCountsRow |
| 152 | if err := s.stmt(` |
| 153 | SELECT d.device_id as deviceid, s.type, s.count, s.size, s.local_flags, s.deleted FROM counts s |
| 154 | INNER JOIN devices d ON d.idx = s.device_idx |
| 155 | `).Select(&res); err != nil { |
| 156 | return wrap(err) |
| 157 | } |
| 158 | |
| 159 | tw := tabwriter.NewWriter(out, 2, 2, 2, ' ', 0) |
| 160 | fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%s\t%s\n", "DEVICE", "TYPE", "FLAGS", "DELETED", "COUNT", "SIZE") |
| 161 | for _, row := range res { |
| 162 | fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%d\t%d\n", shortDevice(row.DeviceID), shortType(row.Type), row.LocalFlags.HumanString(), delMap[row.Deleted], row.Count, row.Size) |
| 163 | } |
| 164 | return tw.Flush() |
| 165 | } |
| 166 | |
| 167 | func (s *folderDB) DebugFilePattern(out io.Writer, name string) error { |
| 168 | type hashFileMetadata struct { |
nothing calls this directly
no test coverage detected