From e2445edcb99ed0aa7fcd40fe7484d71e73367334 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 10 Nov 2019 14:46:55 +0100 Subject: bridge: various improvement on the global token PR --- entity/id.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'entity') 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] +} -- cgit