diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-10 14:46:55 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-11-10 14:53:40 +0100 |
commit | e2445edcb99ed0aa7fcd40fe7484d71e73367334 (patch) | |
tree | f5f38c8d6d6f426631fda7feaddef34332b6040c /entity/id.go | |
parent | 45653bd31d9ec91123ee42803cd5c46b43d18528 (diff) | |
download | git-bug-e2445edcb99ed0aa7fcd40fe7484d71e73367334.tar.gz |
bridge: various improvement on the global token PR
Diffstat (limited to 'entity/id.go')
-rw-r--r-- | entity/id.go | 18 |
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] +} |