JSON: Add fields 'total_size' and 'total_size_h'
authorMikael Berthe <mikael@lilotux.net>
Sun, 14 Oct 2018 15:45:30 +0200
changeset 41 bce80b708ddb
parent 40 7f9cdb9d166d
child 42 3fa13770e970
JSON: Add fields 'total_size' and 'total_size_h'
goduf.go
--- a/goduf.go	Sun Oct 14 15:44:28 2018 +0200
+++ b/goduf.go	Sun Oct 14 15:45:30 2018 +0200
@@ -61,12 +61,14 @@
 
 // Results contains the results of the duplicates search
 type Results struct {
-	Groups             []ResultSet `json:"groups"`
-	Duplicates         uint        `json:"duplicates"`
-	NumberOfSets       uint        `json:"number_of_sets"`
-	RedundantDataSize  uint64      `json:"redundant_data_size"`
-	RedundantDataSizeH string      `json:"redundant_data_size_h"`
-	TotalFileCount     uint        `json:"total_file_count"`
+	Groups             []ResultSet `json:"groups"`                // List of duplicate sets
+	Duplicates         uint        `json:"duplicates"`            // Number of duplicates
+	NumberOfSets       uint        `json:"number_of_sets"`        // Number of duplicate sets
+	RedundantDataSize  uint64      `json:"redundant_data_size"`   // Redundant data size
+	RedundantDataSizeH string      `json:"redundant_data_size_h"` // Same, human-readable
+	TotalFileCount     uint        `json:"total_file_count"`      // Total number of checked files
+	TotalSize          uint64      `json:"total_size"`            // Total size for checked files
+	TotalSizeH         string      `json:"total_size_h"`          // Same, human-readable
 }
 
 // ResultSet contains a group of identical duplicate files
@@ -532,6 +534,8 @@
 	results.NumberOfSets = uint(len(results.Groups))
 	results.RedundantDataSizeH = formatSize(results.RedundantDataSize, true)
 	results.TotalFileCount = data.cmpt
+	results.TotalSize = data.totalSize
+	results.TotalSizeH = formatSize(data.totalSize, true)
 
 	return results, nil
 }