Merge pull request #65 from benbjohnson/fix-tx-buckets-sort-order

Fix Tx.Buckets() sort order.
pull/34/head
Ben Johnson 2014-03-21 08:45:34 -06:00
commit 1c7b59a4c2
2 changed files with 7 additions and 0 deletions

View File

@ -155,3 +155,9 @@ type BucketStat struct {
KeyCount int
MaxDepth int
}
type bucketsByName []*Bucket
func (s bucketsByName) Len() int { return len(s) }
func (s bucketsByName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s bucketsByName) Less(i, j int) bool { return s[i].name < s[j].name }

1
tx.go
View File

@ -89,6 +89,7 @@ func (t *Tx) Buckets() []*Bucket {
}
buckets = append(buckets, bucket)
}
sort.Sort(bucketsByName(buckets))
return buckets
}