aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bucket.go6
-rw-r--r--tx.go1
2 files changed, 7 insertions, 0 deletions
diff --git a/bucket.go b/bucket.go
index 3e3392c..dbd06f1 100644
--- a/bucket.go
+++ b/bucket.go
@@ -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 }
diff --git a/tx.go b/tx.go
index 53f0456..ae6d103 100644
--- a/tx.go
+++ b/tx.go
@@ -89,6 +89,7 @@ func (t *Tx) Buckets() []*Bucket {
}
buckets = append(buckets, bucket)
}
+ sort.Sort(bucketsByName(buckets))
return buckets
}