aboutsummaryrefslogtreecommitdiffstats
path: root/entity
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-11-10 14:46:55 +0100
committerMichael Muré <batolettre@gmail.com>2019-11-10 14:53:40 +0100
commite2445edcb99ed0aa7fcd40fe7484d71e73367334 (patch)
treef5f38c8d6d6f426631fda7feaddef34332b6040c /entity
parent45653bd31d9ec91123ee42803cd5c46b43d18528 (diff)
downloadgit-bug-e2445edcb99ed0aa7fcd40fe7484d71e73367334.tar.gz
bridge: various improvement on the global token PR
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]
+}