Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Commit

Permalink
Merge pull request #65 from benbjohnson/fix-tx-buckets-sort-order
Browse files Browse the repository at this point in the history
Fix Tx.Buckets() sort order.
  • Loading branch information
benbjohnson committed Mar 21, 2014
2 parents 26afa92 + 62cf02e commit 1c7b59a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (t *Tx) Buckets() []*Bucket {
}
buckets = append(buckets, bucket)
}
sort.Sort(bucketsByName(buckets))
return buckets
}

Expand Down

0 comments on commit 1c7b59a

Please sign in to comment.