diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-13 15:08:59 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-13 15:08:59 -0600 |
commit | 62cf02e21a9cd3a791a43758dfab12448672f762 (patch) | |
tree | 0524faf0728c09dcb540ce8772f062de50e91933 | |
parent | Merge pull request #64 from benbjohnson/fix-empty-cursor-last (diff) | |
download | dedo-62cf02e21a9cd3a791a43758dfab12448672f762.tar.gz dedo-62cf02e21a9cd3a791a43758dfab12448672f762.tar.xz |
Fix Tx.Buckets() sort order.
@tv42 reported an issue with bucket names returning incorrectly. Not sure if
this fixes the issue but it is necessary anyway.
-rw-r--r-- | bucket.go | 6 | ||||
-rw-r--r-- | tx.go | 1 |
2 files changed, 7 insertions, 0 deletions
@@ -154,3 +154,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 } @@ -89,6 +89,7 @@ func (t *Tx) Buckets() []*Bucket { } buckets = append(buckets, bucket) } + sort.Sort(bucketsByName(buckets)) return buckets } |