aboutsummaryrefslogtreecommitdiffstats
path: root/entity
diff options
context:
space:
mode:
Diffstat (limited to 'entity')
-rw-r--r--entity/id.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/entity/id.go b/entity/id.go
index 7ff6b223..1b78aacd 100644
--- a/entity/id.go
+++ b/entity/id.go
@@ -65,3 +65,21 @@ func (i Id) Validate() error {
}
return nil
}
+
+/*
+ * Sorting
+ */
+
+type Alphabetical []Id
+
+func (a Alphabetical) Len() int {
+ return len(a)
+}
+
+func (a Alphabetical) Less(i, j int) bool {
+ return a[i] < a[j]
+}
+
+func (a Alphabetical) Swap(i, j int) {
+ a[i], a[j] = a[j], a[i]
+}