Skip to content

Commit 7fbe88f

Browse files
author
XieBiao
committed
type XxxReports
1 parent 8453ff5 commit 7fbe88f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

analysis.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ type Report struct {
1717
AvgTtl uint64
1818
}
1919

20+
type DBReports map[uint64][]Report
21+
22+
type KeyReports map[string]Report
23+
24+
type SortReports []Report
25+
2026
type Analysis struct {
2127
redis *RedisClient
22-
Reports map[uint64][]Report
28+
Reports DBReports
2329
}
2430

25-
type SortReports []Report
26-
2731
func (sr SortReports) Len() int {
2832
return len(sr)
2933
}
@@ -37,7 +41,7 @@ func (sr SortReports) Swap(i, j int) {
3741
}
3842

3943
func NewAnalysis(redis *RedisClient) *Analysis {
40-
return &Analysis{redis, map[uint64][]Report{}}
44+
return &Analysis{redis, DBReports{}}
4145
}
4246

4347
func (analysis Analysis) Start(delimiters []string, limit uint64) {
@@ -52,12 +56,12 @@ func (analysis Analysis) Start(delimiters []string, limit uint64) {
5256
ttl int64
5357
length uint64
5458
sr SortReports
55-
mr map[string]Report
59+
mr KeyReports
5660
)
5761

5862
for db, _ := range databases {
5963
cursor = 0
60-
mr = map[string]Report{}
64+
mr = KeyReports{}
6165

6266
analysis.redis.Select(db)
6367

0 commit comments

Comments
 (0)