Move KV stat gen to separate func
This commit is contained in:
parent
2327149854
commit
354ff0a0d1
|
@ -145,7 +145,8 @@ func (c *cmd) Run(args []string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restructures stats given above to be human readable
|
//Restructures stats given above to be human readable
|
||||||
formattedStats, formattedStatsKV := generateStats(info)
|
formattedStats := generateStats(info)
|
||||||
|
formattedStatsKV := generateKVStats(info)
|
||||||
|
|
||||||
in := &OutputFormat{
|
in := &OutputFormat{
|
||||||
Meta: metaformat,
|
Meta: metaformat,
|
||||||
|
@ -171,7 +172,7 @@ type typeStats struct {
|
||||||
Count int
|
Count int
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateStats(info SnapshotInfo) ([]typeStats, []typeStats) {
|
func generateStats(info SnapshotInfo) []typeStats {
|
||||||
ss := make([]typeStats, 0, len(info.Stats))
|
ss := make([]typeStats, 0, len(info.Stats))
|
||||||
|
|
||||||
for _, s := range info.Stats {
|
for _, s := range info.Stats {
|
||||||
|
@ -180,6 +181,10 @@ func generateStats(info SnapshotInfo) ([]typeStats, []typeStats) {
|
||||||
|
|
||||||
ss = sortTypeStats(ss)
|
ss = sortTypeStats(ss)
|
||||||
|
|
||||||
|
return ss
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateKVStats(info SnapshotInfo) []typeStats {
|
||||||
if len(info.StatsKV) > 0 {
|
if len(info.StatsKV) > 0 {
|
||||||
ks := make([]typeStats, 0, len(info.StatsKV))
|
ks := make([]typeStats, 0, len(info.StatsKV))
|
||||||
|
|
||||||
|
@ -189,10 +194,10 @@ func generateStats(info SnapshotInfo) ([]typeStats, []typeStats) {
|
||||||
|
|
||||||
ks = sortTypeStats(ks)
|
ks = sortTypeStats(ks)
|
||||||
|
|
||||||
return ss, ks
|
return ks
|
||||||
}
|
}
|
||||||
|
|
||||||
return ss, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the stat slice
|
// Sort the stat slice
|
||||||
|
|
Loading…
Reference in New Issue